Fixed extractors based in tests results

This commit is contained in:
Manuel Cortez 2018-12-29 20:18:20 -06:00
parent 2cfa3739a8
commit 855055b192
3 changed files with 7 additions and 2 deletions

View File

@ -18,11 +18,12 @@ class interface(object):
def __init__(self): def __init__(self):
self.results = [] self.results = []
self.needs_transcode = False self.needs_transcode = False
log.debug("Started extraction service for mail.ru music") log.debug("Started extraction service for mail.ru music")
def search(self, text, page=1): def search(self, text, page=1):
if text == "" or text == None:
raise ValueError("Text must be passed and should not be blank.")
site = 'https://my.mail.ru/music/search/%s' % (text) site = 'https://my.mail.ru/music/search/%s' % (text)
log.debug("Retrieving data from {0}...".format(site,)) log.debug("Retrieving data from {0}...".format(site,))
r = requests.get(site) r = requests.get(site)
@ -35,7 +36,7 @@ class interface(object):
s.title = data[0].text.replace("\n", "").replace("\t", "") s.title = data[0].text.replace("\n", "").replace("\t", "")
# s.artist = data[1].text.replace("\n", "").replace("\t", "") # s.artist = data[1].text.replace("\n", "").replace("\t", "")
# print(data) # print(data)
s.url = u"https://my.mail.ru"+urlparse.quote(data[0].__dict__["attrs"]["href"]) s.url = u"https://my.mail.ru"+urlparse.quote(data[0].__dict__["attrs"]["href"].encode("utf-8"))
self.results.append(s) self.results.append(s)
log.debug("{0} results found.".format(len(self.results))) log.debug("{0} results found.".format(len(self.results)))

View File

@ -23,6 +23,8 @@ class interface(object):
log.debug("started extraction service for {0}".format(self.name,)) log.debug("started extraction service for {0}".format(self.name,))
def search(self, text, page=1): def search(self, text, page=1):
if text == "" or text == None:
raise ValueError("Text must be passed and should not be blank.")
if text.startswith("https") or text.startswith("http"): if text.startswith("https") or text.startswith("http"):
return self.search_from_url(text) return self.search_from_url(text)
type = "video" type = "video"

View File

@ -19,6 +19,8 @@ class interface(object):
log.debug("Started extraction service for zaycev.net") log.debug("Started extraction service for zaycev.net")
def search(self, text, page=1): def search(self, text, page=1):
if text == "" or text == None:
raise ValueError("Text must be passed and should not be blank.")
site = "http://zaycev.net/search.html?query_search=%s" % (text,) site = "http://zaycev.net/search.html?query_search=%s" % (text,)
log.debug("Retrieving data from {0}...".format(site,)) log.debug("Retrieving data from {0}...".format(site,))
r = requests.get(site) r = requests.get(site)