summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter
diff options
context:
space:
mode:
authorGravatar Christopher <4Christopher@gmx.de> 2013-03-12 12:55:55 +0100
committerGravatar Christopher <4Christopher@gmx.de> 2013-03-12 12:55:55 +0100
commit121024ca7ee705e2fed5e8705d25484288922b41 (patch)
treef493a8ef94b5466d322e367b80be23d9ec54138d /module/plugins/crypter
parentMovie2kTo: fixed regex to be more reliable (diff)
downloadpyload-121024ca7ee705e2fed5e8705d25484288922b41.tar.xz
Movie2kTo: fixed hoster recognition
It appeared to me that the hoster and the id of a video can be present in either a JavaScript section or in a HTML section on *one* page. I first assumed that all hosters on one page can be found ether in a JavaScript section or in a HTML section.
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r--module/plugins/crypter/Movie2kTo.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py
index c32f6f930..3be3be73c 100644
--- a/module/plugins/crypter/Movie2kTo.py
+++ b/module/plugins/crypter/Movie2kTo.py
@@ -89,17 +89,12 @@ class Movie2kTo(Crypter):
re_hoster_id_js = re.compile(r'links\[(\d+?)\].+&nbsp;(.+?)</a>')
re_hoster_id_html = re.compile(r'</td><td.*?<a href=".*?(\d{7}).*?".+?&nbsp;(.+?)</a>')
## I assume that the ID is 7 digits longs
- if re_hoster_id_js.search(self.html):
- re_hoster_id = re_hoster_id_js
- self.logDebug('Assuming that the ID can be found in a JavaScript section.')
- elif re_hoster_id_html.search(self.html):
- re_hoster_id = re_hoster_id_html
- self.logDebug('Assuming that the ID can be found in a HTML section.')
count = defaultdict(int)
- for h_id, hoster in re_hoster_id.findall(self.html):
- # self.logDebug('Hoster %s' % hoster)
+ matches = re_hoster_id_js.findall(self.html)
+ matches += re_hoster_id_html.findall(self.html)
+ for h_id, hoster in matches:
if hoster in accepted_hosters:
- # self.logDebug('Accepted %s' % hoster)
+ self.logDebug('Accepted: %s, ID: %s' % (hoster, h_id))
count[hoster] += 1
if count[hoster] <= firstN:
if h_id != self.id:
@@ -112,6 +107,8 @@ class Movie2kTo(Crypter):
links.append(url)
except:
self.logDebug('Failed to find the URL')
+ else:
+ self.logDebug('Not accepted: %s, ID: %s' % (hoster, h_id))
self.logDebug(links)
return links