diff options
Diffstat (limited to 'module/plugins/hoster/DailymotionCom.py')
-rw-r--r-- | module/plugins/hoster/DailymotionCom.py | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index c6939e5e5..63003dc06 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -4,19 +4,19 @@ import re from module.PyFile import statusMap from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL as get_url +from module.plugins.internal.Hoster import Hoster -def getInfo(urls): +def get_info(urls): result = [] regex = re.compile(DailymotionCom.__pattern__) apiurl = "https://api.dailymotion.com/video/%s" - request = {"fields": "access_error,status,title"} + request = {'fields': "access_error,status,title"} for url in urls: id = regex.match(url).group('ID') - html = getURL(apiurl % id, get=request) + html = get_url(apiurl % id, get=request) info = json_loads(html) name = info['title'] + ".mp4" if "title" in info else url @@ -40,7 +40,8 @@ def getInfo(urls): class DailymotionCom(Hoster): __name__ = "DailymotionCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/.*video/(?P<ID>[\w^_]+)' __config__ = [("quality", "Lowest;LD 144p;LD 240p;SD 384p;HQ 480p;HD 720p;HD 1080p;Highest", "Quality", "Highest")] @@ -51,11 +52,11 @@ class DailymotionCom(Hoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def getStreams(self): + def get_streams(self): streams = [] for result in re.finditer(r"\"(?P<URL>http:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P<QF>.*?)\\.*?)\"", @@ -71,8 +72,8 @@ class DailymotionCom(Hoster): return sorted(streams, key=lambda x: x[0][::-1]) - def getQuality(self): - q = self.getConfig('quality') + def get_quality(self): + q = self.get_config('quality') if q == "Lowest": quality = 0 @@ -84,7 +85,7 @@ class DailymotionCom(Hoster): return quality - def getLink(self, streams, quality): + def get_link(self, streams, quality): if quality > 0: for x, s in [item for item in enumerate(streams)][::-1]: qf = s[0][1] @@ -98,28 +99,28 @@ class DailymotionCom(Hoster): s = streams[idx] - self.logInfo(_("Download video quality %sx%s") % s[0]) + self.log_info(_("Download video quality %sx%s") % s[0]) return s[1] - def checkInfo(self, pyfile): - pyfile.name, pyfile.size, pyfile.status, pyfile.url = getInfo([pyfile.url])[0] + def check_info(self, pyfile): + pyfile.name, pyfile.size, pyfile.status, pyfile.url = get_info([pyfile.url])[0] if pyfile.status == 1: self.offline() elif pyfile.status == 6: - self.tempOffline() + self.temp_offline() def process(self, pyfile): - self.checkInfo(pyfile) + self.check_info(pyfile) id = re.match(self.__pattern__, pyfile.url).group('ID') - self.html = self.load("http://www.dailymotion.com/embed/video/" + id, decode=True) + self.html = self.load("http://www.dailymotion.com/embed/video/" + id) - streams = self.getStreams() - quality = self.getQuality() + streams = self.get_streams() + quality = self.get_quality() - self.download(self.getLink(streams, quality)) + self.download(self.get_link(streams, quality)) |