summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/DailymotionCom.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-26 16:32:38 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-26 16:32:38 +0100
commit3e60fa039c78d7986707e4dc40f11fe9f6ca89af (patch)
tree549a90624c5c8a46bf9e437a74959d5aac3655b7 /module/plugins/hoster/DailymotionCom.py
parentMerge pull request #15 from Peekayy/stable (diff)
downloadpyload-3e60fa039c78d7986707e4dc40f11fe9f6ca89af.tar.xz
cleaned Dailymotion plugin
Diffstat (limited to 'module/plugins/hoster/DailymotionCom.py')
-rw-r--r--module/plugins/hoster/DailymotionCom.py44
1 files changed, 19 insertions, 25 deletions
diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py
index 0385125a4..1b411393d 100644
--- a/module/plugins/hoster/DailymotionCom.py
+++ b/module/plugins/hoster/DailymotionCom.py
@@ -17,37 +17,31 @@ class DailymotionCom(Hoster):
def process(self, pyfile):
html = self.load(pyfile.url, decode=True)
- filename = re.search(r'name="title" content="Dailymotion \\-(.*?)\\- ein Film', html)
- if filename is None:
- filename = re.search(r'<span class="title foreground" title="(.*?)">', html)
- if filename is None:
- filename = re.search(r'class="title" title="(.*?)"', html)
- if filename is None:
- filename = re.search(r'"(?:vs_videotitle|videoTitle|dm_title|ss_mediaTitle)": "(.*?)"', html)
- if filename is None:
- self.fail("Unable to find file name")
+ for pattern in (r'name="title" content="Dailymotion \\-(.*?)\\- ein Film',
+ r'class="title" title="(.*?)"',
+ r'<span class="title foreground" title="(.*?)">',
+ r'"(?:vs_videotitle|videoTitle|dm_title|ss_mediaTitle)": "(.*?)"'):
+ filename = re.search(pattern, html)
+ if filename is not None: break
+ else:
+ self.fail("Unable to find file name")
+
pyfile.name = filename.group(1)+'.mp4'
self.logDebug('Filename='+pyfile.name)
allLinksInfo = re.search(r'"sequence":"(.*?)"', html)
self.logDebug(allLinksInfo.groups())
allLinksInfo = unquote(allLinksInfo.group(1))
-
- dlLink = self.getQuality('hd720URL', allLinksInfo)
- if dlLink is None:
- dlLink = self.getQuality('hqURL', allLinksInfo)
- if dlLink is None:
- dlLink = self.getQuality('sdURL', allLinksInfo)
- if dlLink is None:
- dlLink = self.getQuality('ldURL', allLinksInfo)
- if dlLink is None:
- self.fail(r'Unable to find video URL')
+
+ for quality in ('hd720URL', 'hqURL', 'sdURL', 'ldURL', ''):
+ dlLink = self.getQuality(quality, allLinksInfo)
+ if dlLink is not None: break
else:
- self.logDebug(dlLink)
- self.download(dlLink)
+ self.fail(r'Unable to find video URL')
+
+ self.logDebug(dlLink)
+ self.download(dlLink)
def getQuality(self, quality, data):
link = re.search('"' + quality + '":"(http:[^<>"\']+)"', data)
- if link is None:
- return link
- else:
- return link.group(1).replace('\\','')
+ if link is not None:
+ return link.group(1).replace('\\','') \ No newline at end of file