From f5224f7a581eb5750a6ab9de2302ed749fb77540 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Thu, 1 Dec 2011 21:45:11 +0100 Subject: megaupload decode file info, megaupload/depositfiles folders --- module/plugins/crypter/CrockoComFolder.py | 14 ++++++++ module/plugins/crypter/DepositfilesComFolder.py | 14 ++++++++ module/plugins/crypter/FshareVnFolder.py | 14 ++++++++ module/plugins/crypter/MegauploadComFolder.py | 22 +++++++++++++ module/plugins/hoster/MegauploadCom.py | 10 +++--- module/plugins/internal/SimpleCrypter.py | 44 +++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 module/plugins/crypter/CrockoComFolder.py create mode 100644 module/plugins/crypter/DepositfilesComFolder.py create mode 100644 module/plugins/crypter/FshareVnFolder.py create mode 100644 module/plugins/crypter/MegauploadComFolder.py create mode 100644 module/plugins/internal/SimpleCrypter.py (limited to 'module/plugins') diff --git a/module/plugins/crypter/CrockoComFolder.py b/module/plugins/crypter/CrockoComFolder.py new file mode 100644 index 000000000..d727ec7ab --- /dev/null +++ b/module/plugins/crypter/CrockoComFolder.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + +class CrockoComFolder(SimpleCrypter): + __name__ = "CrockoComFolder" + __type__ = "crypter" + __pattern__ = r"http://(www\.)?crocko.com/f/.*" + __version__ = "0.01" + __description__ = """Crocko.com Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + LINK_PATTERN = r'download' \ No newline at end of file diff --git a/module/plugins/crypter/DepositfilesComFolder.py b/module/plugins/crypter/DepositfilesComFolder.py new file mode 100644 index 000000000..9023b238f --- /dev/null +++ b/module/plugins/crypter/DepositfilesComFolder.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + +class DepositfilesComFolder(SimpleCrypter): + __name__ = "DepositfilesComFolder" + __type__ = "crypter" + __pattern__ = r"http://(www\.)?depositfiles.com/folders/\w+" + __version__ = "0.01" + __description__ = """Depositfiles.com Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + LINK_PATTERN = r'
]*>\s*' \ No newline at end of file diff --git a/module/plugins/crypter/FshareVnFolder.py b/module/plugins/crypter/FshareVnFolder.py new file mode 100644 index 000000000..2515e7edd --- /dev/null +++ b/module/plugins/crypter/FshareVnFolder.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + +class FshareVnFolder(SimpleCrypter): + __name__ = "FshareVnFolder" + __type__ = "crypter" + __pattern__ = r"http://(www\.)?fshare.vn/folder/.*" + __version__ = "0.01" + __description__ = """Fshare.vn Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + LINK_PATTERN = r'
  • ' \ No newline at end of file diff --git a/module/plugins/crypter/MegauploadComFolder.py b/module/plugins/crypter/MegauploadComFolder.py new file mode 100644 index 000000000..e18c10758 --- /dev/null +++ b/module/plugins/crypter/MegauploadComFolder.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter +from re import search +from time import time + +class MegauploadComFolder(SimpleCrypter): + __name__ = "MegauploadComFolder" + __type__ = "crypter" + __pattern__ = r"http://(?:www\.)?megaupload.com/(?:\?f|xml/folderfiles.php\?folderid)=(\w+)" + __version__ = "0.01" + __description__ = """Depositfiles.com Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + LINK_PATTERN = r']*?url="([^"]+)[^>]*?expired="0">' + + def init (self): + folderid = search(self.__pattern__, self.pyfile.url).group(1) + uniq = time() * 1000 + self.url = "http://www.megaupload.com/xml/folderfiles.php?folderid=%s&uniq=%d" % (folderid, uniq) + diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 4854dcef7..87ac3f7f9 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -25,7 +25,7 @@ def getInfo(urls): fileIds.append(match.group("id")) for i, fileId in enumerate(fileIds): post["id%i" % i] = fileId - response = getURL(MegauploadCom.API_URL, post=post) + response = getURL(MegauploadCom.API_URL, post=post, decode = True) # Process API response parts = [re.split(r"&(?!amp;|#\d+;)", x) for x in re.split(r"&?(?=id[\d]+=)", response)] @@ -53,7 +53,7 @@ def _translateAPIFileInfo(apiFileId, apiFileDataMap, apiHosterMap): fileInfo = {} try: fileInfo['status'] = MegauploadCom.API_STATUS_MAPPING[apiFileDataMap[apiFileId]] - fileInfo['name'] = apiFileDataMap['n'] + fileInfo['name'] = html_unescape(apiFileDataMap['n']) fileInfo['size'] = int(apiFileDataMap['s']) fileInfo['hoster'] = apiHosterMap[apiFileDataMap['d']] except: @@ -65,7 +65,7 @@ class MegauploadCom(Hoster): __name__ = "MegauploadCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?(megaupload)\.com/.*?(\?|&)d=(?P[0-9A-Za-z]+)" - __version__ = "0.26" + __version__ = "0.27" __description__ = """Megaupload.com Download Hoster""" __author_name__ = ("spoob") __author_mail__ = ("spoob@pyload.org") @@ -211,7 +211,7 @@ class MegauploadCom(Hoster): fileId = self.pyfile.url.split("=")[-1] # Get file id from url apiFileId = "id0" post = {apiFileId: fileId} - response = getURL(self.API_URL, post=post) + response = getURL(self.API_URL, post=post, decode = True) self.log.debug("%s: API response [%s]" % (self.__name__, response)) # Translate API response @@ -271,4 +271,4 @@ class MegauploadCom(Hoster): if re.search("The password you have entered is not correct", self.html[1]): self.fail(_("Wrong password for download link.")) - return True + return True \ No newline at end of file diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py new file mode 100644 index 000000000..69798bc0a --- /dev/null +++ b/module/plugins/internal/SimpleCrypter.py @@ -0,0 +1,44 @@ +# -*- 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: zoidberg +""" + +from re import findall +from module.plugins.Crypter import Crypter + +class SimpleCrypter(Crypter): + __name__ = "SimpleCrypter" + __version__ = "0.01" + __pattern__ = None + __type__ = "crypter" + __description__ = """Base crypter plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def init(self): + self.url = self.pyfile.url + + def decrypt(self, pyfile): + self.html = self.load(self.url) + + new_links = [] + new_links.extend(findall(self.LINK_PATTERN, self.html)) + + if new_links: + self.core.files.addLinks(new_links, self.pyfile.package().id) + else: + self.fail('Could not extract any links') \ No newline at end of file -- cgit v1.2.3