import requests
from lxml import html
from time import sleep
ask = input("Start? (y/n) :")
while ask is not 'n':
keywords = input("Enter your keywords for search: ")
URL = "http://subtitlepedia.co/download/viewdownload/27/index.php?option=com_search&searchword={}&searchphrase=exact&ordering=newest&areas[0]=jdownloads".format(keywords)
page = requests.get(URL)
doc = html.fromstring(page.text)
path = doc.xpath('//dl[@class="search-results"]/dt[@class="result-title"]/a/@href')
print(len(path))
for p in path:
print("http://www.subtitlepedia.co{}".format(p))
ask = input("Start? (y/n) :")
if ask is 'n':
print("Goodbye ...")
sleep(3)
break