diff options
author | Christopher <4Christopher@gmx.de> | 2013-02-27 00:19:55 +0100 |
---|---|---|
committer | Christopher <4Christopher@gmx.de> | 2013-02-27 14:35:45 +0100 |
commit | 9b8edbfaf1e9c255c6e05458c4c805d325c64cb8 (patch) | |
tree | 3a0a8cb70a16c21a0fe9adfd995a609502bcc020 /module | |
parent | added hoster/XvidstageCom.py (diff) | |
download | pyload-9b8edbfaf1e9c255c6e05458c4c805d325c64cb8.tar.xz |
fixed support for films
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/crypter/Movie2kTo.py | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py index a79b32938..7f30d1649 100644 --- a/module/plugins/crypter/Movie2kTo.py +++ b/module/plugins/crypter/Movie2kTo.py @@ -8,7 +8,7 @@ class Movie2kTo(Crypter): __name__ = "Movie2kTo" __type__ = "container" __pattern__ = r"http://(?:www\.)?movie2k\.to/(.*)\.html" - __version__ = "0.1" + __version__ = "0.1.1" __config__ = [("accepted_hosters", "str", "List of accepted hosters", "Xvidstage, "), ("whole_season", "bool", "Download whole season", "False"), ("everything", "bool", "Download everything", "False")] @@ -17,13 +17,12 @@ class Movie2kTo(Crypter): __author_mail__ = ('4Christopher@gmx.de') BASE_URL_PATTERN = r'http://(?:www\.)?movie2k\.to/' TVSHOW_URL_PATH_PATTERN = r'tvshows-(?P<id>\d+?)-(?P<name>.+)' - FILM_URL_PATH_PATTERN = r'(?P<name>.+?)-online-film-(?P<id>\d+)' + FILM_URL_PATH_PATTERN = r'(?P<name>.+?)-(?:online-film|watch-movie)-(?P<id>\d+)' SEASON_PATTERN = r'<div id="episodediv(\d+?)" style="display:(inline|none)">(.*?)</div>' EP_PATTERN = r'<option value="(.+?)"( selected)?>Episode\s*?(\d+?)</option>' BASE_URL = 'http://www.movie2k.to' def decrypt(self, pyfile): - self.html = self.load(pyfile.url) self.package = pyfile.package() self.folder = self.package.folder whole_season = self.getConfig('whole_season') @@ -40,19 +39,15 @@ class Movie2kTo(Crypter): self.logDebug('%s: %s' % (season_name, url_path)) if ep_sel and (season_sel == 'inline'): self.logDebug('%s selected (in the start URL: %s)' % (season_name, pyfile.url)) - season_links += self.getLinks('%s/%s' % (self.BASE_URL, url_path)) + season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path)) elif (whole_season and (season_sel == 'inline')) or everything: - season_links += self.getLinks('%s/%s' % (self.BASE_URL, url_path)) + url = '%s/%s' % (self.BASE_URL, url_path) + season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path)) self.packages.append(('Season %s' % season, season_links, 'Season %s' % season)) else: - self.getLinks(pyfile.url) - if self.format != 'film': - self.name = self.package.name - self.logDebug('Using new name: %s' % self.name) - self.logDebug('folder name: %s' % self.package.folder) - self.packages.append((self.name, links, self.package.folder)) - + self.packages.append((self.package.name, self.getLinks(), self.package.folder)) + def tvshow_number(self, number): if int(number) < 10: return '0%s' % number @@ -62,17 +57,16 @@ class Movie2kTo(Crypter): return '%s S%sE%s' % (self.name, self.tvshow_number(season), self.tvshow_number(ep)) def getInfo(self, url): + self.html = self.load(url) self.url_path = re.match(self.__pattern__, url).group(1) self.logDebug('URL Path: %s' % self.url_path) self.format = pattern_re = None if re.match(r'tvshows', self.url_path): self.format = 'tvshow' pattern_re = re.search(self.TVSHOW_URL_PATH_PATTERN, self.url_path) - elif re.search(r'.*online-film-\d+?\.html', self.url_path): + elif re.search(self.FILM_URL_PATH_PATTERN, self.url_path): self.format = 'film' pattern_re = re.search(self.FILM_URL_PATH_PATTERN, self.url_path) - else: - self.format = 'porn' self.logDebug('Format: %s' % self.format) @@ -81,18 +75,27 @@ class Movie2kTo(Crypter): self.id = pattern_re.group('id') self.logDebug('ID: %s' % self.id) - def getLinks(self, url): + def getInfoAndLinks(self, url): + self.getInfo(url) + return self.getLinks() + + def getLinks(self): accepted_hosters = re.findall(r'\b(\w+?)\b', self.getConfig('accepted_hosters')) links = [] ## h_id: hoster_id of a possible hoster - for h_id, hoster in re.findall(r'links\[(\d+?)\].* (.*?)</a>', self.html): + if self.format == 'tvshow': + re_hoster_id = re.compile(r'links\[(\d+?)\].+ (.+?)</a>') + else: + re_hoster_id = re.compile(r'<a href=".*?(\d{7}).*?".+? (.+?)</a>') + ## I assume that the ID is 7 digits longs + for h_id, hoster in re_hoster_id.findall(self.html): if hoster in accepted_hosters: if h_id != self.id: self.html = self.load('%s/tvshows-%s-%s.html' % (self.BASE_URL, h_id, self.name)) else: self.logDebug('This is already the right ID') try: - url = re.search(r'<a target="_blank" href="(.*?)"', self.html).group(1) + url = re.search(r'<a target="_blank" href="(http://.*?)"', self.html).group(1) self.logDebug('id: %s, %s: %s' % (h_id, hoster, url)) links.append(url) except: |