diff options
author | Stefano <l.stickell@yahoo.it> | 2014-04-21 17:26:28 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-04-21 17:26:28 +0200 |
commit | e88c477d1ae3913096b92f41274ef578693bc052 (patch) | |
tree | fca8eb2f696afbaeb11c7bb61b38aca584a0b0d7 /pyload/plugins/crypter | |
parent | CaptchaService: fixed missing import (diff) | |
download | pyload-e88c477d1ae3913096b92f41274ef578693bc052.tar.xz |
Moving new plugins from module to pyload
Diffstat (limited to 'pyload/plugins/crypter')
-rw-r--r-- | pyload/plugins/crypter/DailymotionBatch.py | 111 | ||||
-rw-r--r-- | pyload/plugins/crypter/DlProtectCom.py | 74 | ||||
-rw-r--r-- | pyload/plugins/crypter/MultiUpOrg.py | 49 | ||||
-rw-r--r-- | pyload/plugins/crypter/NosvideoCom.py | 16 | ||||
-rw-r--r-- | pyload/plugins/crypter/TnyCz.py | 38 | ||||
-rw-r--r-- | pyload/plugins/crypter/TusfilesNetFolder.py | 53 |
6 files changed, 341 insertions, 0 deletions
diff --git a/pyload/plugins/crypter/DailymotionBatch.py b/pyload/plugins/crypter/DailymotionBatch.py new file mode 100644 index 000000000..5c0dd9cec --- /dev/null +++ b/pyload/plugins/crypter/DailymotionBatch.py @@ -0,0 +1,111 @@ +# -*- 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 <http://www.gnu.org/licenses/>. + + @author: Walter Purcaro +""" + +from urlparse import urljoin +import re + +from module.common.json_layer import json_loads +from module.plugins.Crypter import Crypter +from module.utils import save_join + + +class DailymotionBatch(Crypter): + __name__ = "DailymotionBatch" + __type__ = "crypter" + __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?P<TYPE>playlist|user)/)?(?P<ID>[\w^_]+)(?(TYPE)|#)' + __version__ = "0.01" + __description__ = """Dailymotion.com channel & playlist decrypter""" + __author_name__ = "Walter Purcaro" + __author_mail__ = "vuolter@gmail.com" + + def api_response(self, ref, req=None): + url = urljoin("https://api.dailymotion.com/", ref) + page = self.load(url, get=req) + return json_loads(page) + + def getPlaylistInfo(self, id): + ref = "playlist/" + id + req = {"fields": "name,owner.screenname"} + playlist = self.api_response(ref, req) + + if "error" in playlist: + return + + name = playlist["name"] + owner = playlist["owner.screenname"] + return name, owner + + def _getPlaylists(self, user_id, page=1): + ref = "user/%s/playlists" % user_id + req = {"fields": "id", "page": page, "limit": 100} + user = self.api_response(ref, req) + + if "error" in user: + return + + for playlist in user["list"]: + yield playlist["id"] + + if user["has_more"]: + for item in self._getPlaylists(user_id, page + 1): + yield item + + def getPlaylists(self, user_id): + return [(id,) + self.getPlaylistInfo(id) for id in self._getPlaylists(user_id)] + + def _getVideos(self, id, page=1): + ref = "playlist/%s/videos" % id + req = {"fields": "url", "page": page, "limit": 100} + playlist = self.api_response(ref, req) + + if "error" in playlist: + return + + for video in playlist["list"]: + yield video["url"] + + if playlist["has_more"]: + for item in self._getVideos(id, page + 1): + yield item + + def getVideos(self, playlist_id): + return list(self._getVideos(playlist_id))[::-1] + + def decrypt(self, pyfile): + m = re.match(self.__pattern__, pyfile.url) + m_id = m.group("ID") + m_type = m.group("TYPE") + + if m_type == "playlist": + self.logDebug("Url recognized as Playlist") + p_info = self.getPlaylistInfo(m_id) + playlists = [(m_id,) + p_info] if p_info else None + else: + self.logDebug("Url recognized as Channel") + playlists = self.getPlaylists(m_id) + self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), m_id)) + + if not playlists: + self.fail("No playlist available") + + for p_id, p_name, p_owner in playlists: + p_videos = self.getVideos(p_id) + p_folder = save_join(self.config['general']['download_folder'], p_owner, p_name) + self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) + self.packages.append((p_name, p_videos, p_folder)) #: folder is NOT recognized by pyload 0.4.9! diff --git a/pyload/plugins/crypter/DlProtectCom.py b/pyload/plugins/crypter/DlProtectCom.py new file mode 100644 index 000000000..dbe5bf705 --- /dev/null +++ b/pyload/plugins/crypter/DlProtectCom.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +############################################################################### +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author: Walter Purcaro +############################################################################### + +import re +from base64 import urlsafe_b64encode +from time import time + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class DlProtectCom(SimpleCrypter): + __name__ = "DlProtectCom" + __type__ = "crypter" + __pattern__ = r'http://(?:www\.)?dl-protect\.com/((en|fr)/)?(?P<ID>\w+)' + __version__ = "0.01" + __description__ = """Dl-protect.com decrypter plugin""" + __author_name__ = "Walter Purcaro" + __author_mail__ = "vuolter@gmail.com" + + OFFLINE_PATTERN = ">Unfortunately, the link you are looking for is not found" + + def getLinks(self): + # Direct link with redirect + if not re.match(r"http://(?:www\.)?dl-protect\.com", self.req.http.lastEffectiveURL): + return [self.req.http.lastEffectiveURL] + + #id = re.match(self.__pattern__, self.pyfile.url).group("ID") + key = re.search(r'name="id_key" value="(.+?)"', self.html).group(1) + + post_req = {"id_key": key, "submitform": ""} + + if self.OFFLINE_PATTERN in self.html: + self.offline() + elif ">Please click on continue to see the content" in self.html: + post_req.update({"submitform": "Continue"}) + else: + mstime = int(round(time() * 1000)) + b64time = "_" + urlsafe_b64encode(str(mstime)).replace("=", "%3D") + + post_req.update({"i": b64time, "submitform": "Decrypt+link"}) + + if ">Password :" in self.html: + post_req["pwd"] = self.getPassword() + + if ">Security Code" in self.html: + captcha_id = re.search(r'/captcha\.php\?uid=(.+?)"', self.html).group(1) + captcha_url = "http://www.dl-protect.com/captcha.php?uid=" + captcha_id + captcha_code = self.decryptCaptcha(captcha_url, imgtype="gif") + + post_req["secure"] = captcha_code + + self.html = self.load(self.pyfile.url, post=post_req) + + for errmsg in (">The password is incorrect", ">The security code is incorrect"): + if errmsg in self.html: + self.fail(errmsg[1:]) + + pattern = r'<a href="([^/].+?)" target="_blank">' + return re.findall(pattern, self.html) diff --git a/pyload/plugins/crypter/MultiUpOrg.py b/pyload/plugins/crypter/MultiUpOrg.py new file mode 100644 index 000000000..997d60862 --- /dev/null +++ b/pyload/plugins/crypter/MultiUpOrg.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +############################################################################### +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author: Walter Purcaro +############################################################################### + +import re +from urlparse import urljoin + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class MultiUpOrg(SimpleCrypter): + __name__ = "MultiUpOrg" + __type__ = "crypter" + __pattern__ = r"http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|miror)/\w+(/\w+)?" + __version__ = "0.01" + __description__ = """MultiUp.org crypter plugin""" + __author_name__ = "Walter Purcaro" + __author_mail__ = "vuolter@gmail.com" + + TITLE_PATTERN = r'<title>.*(Project|Projet|ownload|élécharger) (?P<title>.+?) (\(|- )' + + def getLinks(self): + m_type = re.match(self.__pattern__, self.pyfile.url).group("TYPE") + + if m_type == "project": + pattern = r'\n(http://www\.multiup\.org/(?:en|fr)/download/.*)' + else: + pattern = r'style="width:97%;text-align:left".*\n.*href="(.*)"' + if m_type == "download": + dl_pattern = r'href="(.*)">.*\n.*<h5>DOWNLOAD</h5>' + miror_page = urljoin("http://www.multiup.org", re.search(dl_pattern, self.html).group(1)) + self.html = self.load(miror_page) + + return re.findall(pattern, self.html) diff --git a/pyload/plugins/crypter/NosvideoCom.py b/pyload/plugins/crypter/NosvideoCom.py new file mode 100644 index 000000000..63e199a7a --- /dev/null +++ b/pyload/plugins/crypter/NosvideoCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class NosvideoCom(SimpleCrypter): + __name__ = "NosvideoCom" + __type__ = "crypter" + __pattern__ = r'http://(?:www\.)?nosvideo\.com/\?v=\w+' + __version__ = "0.01" + __description__ = """Nosvideo.com decrypter plugin""" + __author_name__ = "igel" + __author_mail__ = "igelkun@myopera.com" + + LINK_PATTERN = r'href="(http://(?:w{3}\.)?nosupload.com/\?d=\w+)"' + TITLE_PATTERN = r"<[tT]itle>Watch (?P<title>.+)</[tT]itle>" diff --git a/pyload/plugins/crypter/TnyCz.py b/pyload/plugins/crypter/TnyCz.py new file mode 100644 index 000000000..6c56f7639 --- /dev/null +++ b/pyload/plugins/crypter/TnyCz.py @@ -0,0 +1,38 @@ +# -*- 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 <http://www.gnu.org/licenses/>. + + @author: Walter Purcaro +""" + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + +import re + + +class TnyCz(SimpleCrypter): + __name__ = "TnyCz" + __type__ = "crypter" + __pattern__ = r'http://(?:www\.)?tny\.cz/\w+' + __version__ = "0.01" + __description__ = """Tny.cz decrypter plugin""" + __author_name__ = "Walter Purcaro" + __author_mail__ = "vuolter@gmail.com" + + TITLE_PATTERN = r'<title>(?P<title>.+) - .+</title>' + + def getLinks(self): + m = re.search(r'<a id=\'save_paste\' href="(.+save\.php\?hash=.+)">', self.html) + return re.findall(".+", self.load(m.group(1), decode=True)) if m else None diff --git a/pyload/plugins/crypter/TusfilesNetFolder.py b/pyload/plugins/crypter/TusfilesNetFolder.py new file mode 100644 index 000000000..0bc770f99 --- /dev/null +++ b/pyload/plugins/crypter/TusfilesNetFolder.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################### +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author: Walter Purcaro +############################################################################### + +import math +import re +from urlparse import urljoin + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class TusfilesNetFolder(SimpleCrypter): + __name__ = "TusfilesNetFolder" + __type__ = "crypter" + __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)/?' + __version__ = "0.01" + __description__ = """Tusfiles.net folder decrypter plugin""" + __author_name__ = ("Walter Purcaro", "stickell") + __author_mail__ = ("vuolter@gmail.com", "l.stickell@yahoo.it") + + LINK_PATTERN = r'<TD align=left><a href="(.*?)">' + TITLE_PATTERN = r'<Title>.*?\: (?P<title>.+) folder</Title>' + PAGES_PATTERN = r'>\((?P<pages>\d+) \w+\)<' + + FILE_URL_REPLACEMENTS = [(__pattern__, r'https://www.tusfiles.net/go/\g<ID>/')] + + def loadPage(self, page_n): + return self.load(urljoin(self.pyfile.url, str(page_n)), decode=True) + + def handleMultiPages(self): + pages = re.search(self.PAGES_PATTERN, self.html) + if pages: + pages = int(math.ceil(int(pages.group('pages')) / 25.0)) + else: + return + + for p in xrange(2, pages + 1): + self.html = self.loadPage(p) + self.package_links += self.getLinks() |