From 25caffda8213a92a51a08a346421afe63685eb88 Mon Sep 17 00:00:00 2001 From: Christopher <4Christopher@gmx.de> Date: Tue, 26 Feb 2013 14:56:06 +0100 Subject: wrote crypter/Movie2kTo.py --- module/plugins/crypter/Movie2kTo.py | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 module/plugins/crypter/Movie2kTo.py (limited to 'module/plugins') diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py new file mode 100644 index 000000000..e33dc1d9f --- /dev/null +++ b/module/plugins/crypter/Movie2kTo.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class Movie2kTo(Crypter): + __name__ = "Movie2kTo" + __type__ = "container" + __pattern__ = r"http://(?:www\.)?movie2k\.to/(.*\.html)" + __version__ = "0.1" + __config__ = [("accepted_hosters", "str", "List of accepted hosters", "Xvidstage, ")] + __description__ = """Movie2k.to Container Plugin""" + __author_name__ = ('4Christopher') + __author_mail__ = ('4Christopher@gmx.de') + BASE_URL_PATTERN = r'http://(?:www\.)?movie2k\.to/' + TVSHOW_URL_PATH_PATTERN = r'tvshows-(?P\d+?)-(?P.*)\.html' + FILM_URL_PATH_PATTERN = r'(?P.*)-online-film-(?P\d+?)\.html' + 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 + self.url_path = re.match(self.__pattern__, pyfile.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): + self.format = 'film' + pattern_re = re.search(self.FILM_URL_PATH_PATTERN, self.url_path) + + self.name = pattern_re.group('name') + self.id = pattern_re.group('id') + self.logDebug('Name: %s' % self.name) + self.logDebug('ID: %s' % self.id) + + 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+?)\].* (.*?)', self.html): + if hoster in accepted_hosters: + self.logDebug('id: %s, %s' % (h_id, hoster)) + 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' Date: Tue, 26 Feb 2013 18:27:57 +0100 Subject: added support to add all episodes and/or seasons --- module/plugins/crypter/Movie2kTo.py | 68 +++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 14 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py index e33dc1d9f..a79b32938 100644 --- a/module/plugins/crypter/Movie2kTo.py +++ b/module/plugins/crypter/Movie2kTo.py @@ -7,22 +7,62 @@ from module.plugins.Crypter import Crypter class Movie2kTo(Crypter): __name__ = "Movie2kTo" __type__ = "container" - __pattern__ = r"http://(?:www\.)?movie2k\.to/(.*\.html)" + __pattern__ = r"http://(?:www\.)?movie2k\.to/(.*)\.html" __version__ = "0.1" - __config__ = [("accepted_hosters", "str", "List of accepted hosters", "Xvidstage, ")] + __config__ = [("accepted_hosters", "str", "List of accepted hosters", "Xvidstage, "), + ("whole_season", "bool", "Download whole season", "False"), + ("everything", "bool", "Download everything", "False")] __description__ = """Movie2k.to Container Plugin""" __author_name__ = ('4Christopher') __author_mail__ = ('4Christopher@gmx.de') BASE_URL_PATTERN = r'http://(?:www\.)?movie2k\.to/' - TVSHOW_URL_PATH_PATTERN = r'tvshows-(?P\d+?)-(?P.*)\.html' - FILM_URL_PATH_PATTERN = r'(?P.*)-online-film-(?P\d+?)\.html' + TVSHOW_URL_PATH_PATTERN = r'tvshows-(?P\d+?)-(?P.+)' + FILM_URL_PATH_PATTERN = r'(?P.+?)-online-film-(?P\d+)' + SEASON_PATTERN = r'
(.*?)
' + EP_PATTERN = r'' 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 - self.url_path = re.match(self.__pattern__, pyfile.url).group(1) + whole_season = self.getConfig('whole_season') + everything = self.getConfig('everything') + self.getInfo(pyfile.url) + + if (whole_season or everything) and self.format == 'tvshow': + self.logDebug('Downloading the whole season') + for season, season_sel, html in re.findall(self.SEASON_PATTERN, self.html, re.DOTALL | re.I): + if (season_sel == 'inline') or everything: + season_links = [] + for url_path, ep_sel, ep in re.findall(self.EP_PATTERN, html, re.I): + season_name = self.name_tvshow(season, ep) + 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)) + elif (whole_season and (season_sel == 'inline')) or everything: + season_links += self.getLinks('%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)) + + def tvshow_number(self, number): + if int(number) < 10: + return '0%s' % number + else: + return number + def name_tvshow(self, season, ep): + return '%s S%sE%s' % (self.name, self.tvshow_number(season), self.tvshow_number(ep)) + + def getInfo(self, 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): @@ -31,32 +71,32 @@ class Movie2kTo(Crypter): elif re.search(r'.*online-film-\d+?\.html', 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) self.name = pattern_re.group('name') - self.id = pattern_re.group('id') self.logDebug('Name: %s' % self.name) + self.id = pattern_re.group('id') self.logDebug('ID: %s' % self.id) - accepted_hosters = re.findall(r'\b(\w+?)\b', self.getConfig(accepted_hosters)) + def getLinks(self, url): + 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+?)\].* (.*?)
', self.html): if hoster in accepted_hosters: - self.logDebug('id: %s, %s' % (h_id, hoster)) 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' Date: Wed, 27 Feb 2013 00:18:30 +0100 Subject: added hoster/XvidstageCom.py --- module/plugins/hoster/XvidstageCom.py | 105 ++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 module/plugins/hoster/XvidstageCom.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py new file mode 100644 index 000000000..1994e40ed --- /dev/null +++ b/module/plugins/hoster/XvidstageCom.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: 4Christopher +""" + +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL +import re +import HTMLParser + +def setup(self): + self.wantReconnect = False + self.resumeDownload = True + self.multiDL = True + +def getInfo(urls): + result = [] + + for url in urls: + result.append(parseFileInfo(url, getInfoMode = True)) + yield result + +def parseFileInfo(url, getInfoMode = False): + html = getURL(url) + info = {"name" : url, "size" : 0, "status" : 3} + info['name'] = re.search(r'Filename:(.*?)<', html).group(1) + info['size'] = re.search(r'Size:.*? \((\d+?) bytes\)', html).group(1) + if info['size'] == 0: + info['status'] = 1 + else: + info['status'] = 2 + + if getInfoMode: + return info['name'], info['size'], info['status'], url + else: + return info['name'], info['size'], info['status'], html + + +class XvidstageCom(Hoster): + __name__ = 'XvidstageCom' + __version__ = '0.1.1' + __pattern__ = r'http://(?:www.)?xvidstage.com/(?P[0-9A-Za-z]+)' + __type__ = 'hoster' + __description__ = """A Plugin that allows you to download files from http://xvidstage.com""" + __author_name__ = ('4Christopher') + __author_mail__ = ('4Christopher@gmx.de') + + + def process(self, pyfile): + pyfile.name, pyfile.size, pyfile.status, self.html = parseFileInfo(pyfile.url) + self.logDebug('Name: %s' % pyfile.name) + if pyfile.status == 1: ## offline + self.fail() + self.id = re.search(self.__pattern__, pyfile.url).group('id') + + wait_sec = int(re.search(r'countdown_str">.+?>(\d+?)<', self.html).group(1)) + self.setWait(wait_sec, reconnect=False) + self.logDebug('Waiting %d seconds before submitting the captcha' % wait_sec) + self.wait() + + rand = re.search(r'', self.html).group(1) + self.logDebug('rand: %s, id: %s' % (rand, self.id)) + self.html = self.req.load(pyfile.url, post={'op': 'download2', 'id' : self.id, 'rand' : rand, 'code': self.get_captcha()}) + file_url = re.search(r'(?P=url)', self.html).group('url') + try: + hours_file_available = int(re.search(r'This direct link will be available for your IP next (?P\d+?) hours', self.html).group('hours')) + self.logDebug('You have %d hours to download this file with your current IP address.' % hours_file_available) + except: + self.logDebug('Failed') + self.logDebug('Download file: %s' % file_url) + self.download(file_url) + check = self.checkDownload({'empty': re.compile(r'^$')}) + + if check == 'empty': + self.logInfo('Downloaded File was empty') + # self.retry() + + def get_captcha(self): + ## 1 … + cap_chars = {} + for pad_left, char in re.findall(r"position:absolute;padding-left:(\d+?)px;.*?;'>(.*?)<", self.html): + cap_chars[int(pad_left)] = char + + h = HTMLParser.HTMLParser() + ## Sorting after padding-left + captcha = '' + for pad_left in sorted(cap_chars): + captcha += h.unescape(cap_chars[pad_left]) + + self.logDebug('The captcha is: %s' % captcha) + return captcha -- cgit v1.2.3 From 9b8edbfaf1e9c255c6e05458c4c805d325c64cb8 Mon Sep 17 00:00:00 2001 From: Christopher <4Christopher@gmx.de> Date: Wed, 27 Feb 2013 00:19:55 +0100 Subject: fixed support for films --- module/plugins/crypter/Movie2kTo.py | 39 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'module/plugins') 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\d+?)-(?P.+)' - FILM_URL_PATH_PATTERN = r'(?P.+?)-online-film-(?P\d+)' + FILM_URL_PATH_PATTERN = r'(?P.+?)-(?:online-film|watch-movie)-(?P\d+)' SEASON_PATTERN = r'
(.*?)
' EP_PATTERN = r'' 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+?)\].* (.*?)', self.html): + if self.format == 'tvshow': + re_hoster_id = re.compile(r'links\[(\d+?)\].+ (.+?)') + else: + re_hoster_id = re.compile(r'') + ## 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' Date: Wed, 27 Feb 2013 13:21:13 +0100 Subject: little fixes --- module/plugins/crypter/Movie2kTo.py | 30 +++++++++++++++++------------- module/plugins/hoster/XvidstageCom.py | 7 +++---- 2 files changed, 20 insertions(+), 17 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py index 7f30d1649..a9cdb188b 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.1" + __version__ = "0.2" __config__ = [("accepted_hosters", "str", "List of accepted hosters", "Xvidstage, "), ("whole_season", "bool", "Download whole season", "False"), ("everything", "bool", "Download everything", "False")] @@ -41,9 +41,8 @@ class Movie2kTo(Crypter): self.logDebug('%s selected (in the start URL: %s)' % (season_name, pyfile.url)) season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path)) elif (whole_season and (season_sel == 'inline')) or everything: - 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)) + self.packages.append(('%s: Season %s' % (self.name, season), season_links, 'Season %s' % season)) else: self.packages.append((self.package.name, self.getLinks(), self.package.folder)) @@ -53,13 +52,13 @@ class Movie2kTo(Crypter): return '0%s' % number else: return number + def name_tvshow(self, season, ep): 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' @@ -68,13 +67,12 @@ class Movie2kTo(Crypter): self.format = 'film' pattern_re = re.search(self.FILM_URL_PATH_PATTERN, self.url_path) - self.logDebug('Format: %s' % self.format) self.name = pattern_re.group('name') - self.logDebug('Name: %s' % self.name) self.id = pattern_re.group('id') - self.logDebug('ID: %s' % self.id) - + self.logDebug('URL Path: %s (ID: %s, Name: %s, Format: %s)' + % (self.url_path, self.id, self.name, self.format)) + def getInfoAndLinks(self, url): self.getInfo(url) return self.getLinks() @@ -83,11 +81,13 @@ class Movie2kTo(Crypter): accepted_hosters = re.findall(r'\b(\w+?)\b', self.getConfig('accepted_hosters')) links = [] ## h_id: hoster_id of a possible hoster - if self.format == 'tvshow': - re_hoster_id = re.compile(r'links\[(\d+?)\].+ (.+?)') - else: - re_hoster_id = re.compile(r'') - ## I assume that the ID is 7 digits longs + re_hoster_id_js = re.compile(r'links\[(\d+?)\].+ (.+?)') + re_hoster_id_html = re.compile(r'') + ## I assume that the ID is 7 digits longs + if re_hoster_id_js.search(self.html): + re_hoster_id = re_hoster_id_js + elif re_hoster_id_html.search(self.html): + re_hoster_id = re_hoster_id_html for h_id, hoster in re_hoster_id.findall(self.html): if hoster in accepted_hosters: if h_id != self.id: @@ -101,5 +101,9 @@ class Movie2kTo(Crypter): except: self.logDebug('Failed to find the URL') + # self.logDebug(links[-1]) ## Last link, this is probably everything + ## you will need + # links.append('http://localhost/IfTheProcessFunctionReturnsOnlyOneLinkItWillFail') self.logDebug(links) + # return links[-1] return links diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py index 1994e40ed..38c54efec 100644 --- a/module/plugins/hoster/XvidstageCom.py +++ b/module/plugins/hoster/XvidstageCom.py @@ -37,8 +37,8 @@ def getInfo(urls): def parseFileInfo(url, getInfoMode = False): html = getURL(url) info = {"name" : url, "size" : 0, "status" : 3} - info['name'] = re.search(r'Filename:(.*?)<', html).group(1) - info['size'] = re.search(r'Size:.*? \((\d+?) bytes\)', html).group(1) + info['name'] = re.search(r'(?:Filename|Dateiname):]*?>(.*?)<', html).group(1) + info['size'] = re.search(r'(?:Size|Größe):.*? \((\d+?) bytes\)', html).group(1) if info['size'] == 0: info['status'] = 1 else: @@ -49,10 +49,9 @@ def parseFileInfo(url, getInfoMode = False): else: return info['name'], info['size'], info['status'], html - class XvidstageCom(Hoster): __name__ = 'XvidstageCom' - __version__ = '0.1.1' + __version__ = '0.2' __pattern__ = r'http://(?:www.)?xvidstage.com/(?P[0-9A-Za-z]+)' __type__ = 'hoster' __description__ = """A Plugin that allows you to download files from http://xvidstage.com""" -- cgit v1.2.3