summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r--module/plugins/crypter/DataHuFolder.py55
-rw-r--r--module/plugins/crypter/GooGl.py41
-rw-r--r--module/plugins/crypter/MBLinkInfo.py27
-rw-r--r--module/plugins/crypter/NetfolderIn.py48
-rw-r--r--module/plugins/crypter/SpeedLoadOrgFolder.py15
-rw-r--r--module/plugins/crypter/UlozToFolder.py2
-rw-r--r--module/plugins/crypter/UploadedToFolder.py37
-rw-r--r--module/plugins/crypter/YoutubeBatch.py35
8 files changed, 202 insertions, 58 deletions
diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py
new file mode 100644
index 000000000..f710f60d7
--- /dev/null
+++ b/module/plugins/crypter/DataHuFolder.py
@@ -0,0 +1,55 @@
+# -*- 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/>. #
+############################################################################
+
+import re
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class DataHuFolder(SimpleCrypter):
+ __name__ = "DataHuFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?data.hu/dir/\w+"
+ __version__ = "0.03"
+ __description__ = """Data.hu Folder Plugin"""
+ __author_name__ = ("crash", "stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r"<a href='(http://data\.hu/get/.+)' target='_blank'>\1</a>"
+ TITLE_PATTERN = ur'<title>(?P<title>.+) Let\xf6lt\xe9se</title>'
+
+ def decrypt(self, pyfile):
+ self.html = self.load(pyfile.url, decode=True)
+
+ if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected
+ password = self.getPassword()
+ if password is '':
+ self.fail("No password specified, please set right password on Add package form and retry")
+ self.logDebug('The folder is password protected', 'Using password: ' + password)
+ self.html = self.load(pyfile.url, post={'mappa_pass': password}, decode=True)
+ if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password
+ self.fail("Incorrect password, please set right password on Add package form and retry")
+
+ package_name, folder_name = self.getPackageNameAndFolder()
+
+ package_links = re.findall(self.LINK_PATTERN, self.html)
+ self.logDebug('Package has %d links' % len(package_links))
+
+ if package_links:
+ self.packages = [(package_name, package_links, folder_name)]
+ else:
+ self.fail('Could not extract any links')
diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py
new file mode 100644
index 000000000..bcb1d7494
--- /dev/null
+++ b/module/plugins/crypter/GooGl.py
@@ -0,0 +1,41 @@
+# -*- 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/>. #
+############################################################################
+
+from module.plugins.Crypter import Crypter
+from module.common.json_layer import json_loads
+
+
+class GooGl(Crypter):
+ __name__ = "GooGl"
+ __type__ = "crypter"
+ __pattern__ = r"https?://(www\.)?goo\.gl/\w+"
+ __version__ = "0.01"
+ __description__ = """Goo.gl Crypter Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ API_URL = 'https://www.googleapis.com/urlshortener/v1/url'
+
+ def decrypt(self, pyfile):
+ rep = self.load(self.API_URL, get={'shortUrl': pyfile.url})
+ self.logDebug('JSON data: ' + rep)
+ rep = json_loads(rep)
+
+ if 'longUrl' in rep:
+ self.core.files.addLinks([rep['longUrl']], self.pyfile.package().id)
+ else:
+ self.fail('Unable to expand shortened link')
diff --git a/module/plugins/crypter/MBLinkInfo.py b/module/plugins/crypter/MBLinkInfo.py
new file mode 100644
index 000000000..e266c7722
--- /dev/null
+++ b/module/plugins/crypter/MBLinkInfo.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Crypter import Crypter
+
+
+class MBLinkInfo(Crypter):
+ __name__ = "MBLinkInfo"
+ __type__ = "container"
+ __pattern__ = r"http://(?:www\.)?mblink\.info/?\?id=(\d+)"
+ __version__ = "0.02"
+ __description__ = """MBLink.Info Container Plugin"""
+ __author_name__ = ("Gummibaer", "stickell")
+ __author_mail__ = ("Gummibaer@wiki-bierkiste.de", "l.stickell@yahoo.it")
+
+ URL_PATTERN = r'<meta[^;]+; URL=(.*)["\']>'
+
+ def decrypt(self, pyfile):
+ src = self.load(pyfile.url)
+ found = re.search(self.URL_PATTERN, src)
+ if found:
+ link = found.group(1)
+ self.logDebug("Redirected to " + link)
+ self.core.files.addLinks([link], self.pyfile.package().id)
+ else:
+ self.fail('Unable to detect valid link')
diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py
index d71a73d0a..c5c602c27 100644
--- a/module/plugins/crypter/NetfolderIn.py
+++ b/module/plugins/crypter/NetfolderIn.py
@@ -1,22 +1,25 @@
# -*- coding: utf-8 -*-
-from module.plugins.Crypter import Crypter
import re
-class NetfolderIn(Crypter):
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class NetfolderIn(SimpleCrypter):
__name__ = "NetfolderIn"
__type__ = "crypter"
__pattern__ = r"http://(?:www\.)?netfolder.in/((?P<id1>\w+)/\w+|folder.php\?folder_id=(?P<id2>\w+))"
- __version__ = "0.4"
+ __version__ = "0.6"
__description__ = """NetFolder Crypter Plugin"""
__author_name__ = ("RaNaN", "fragonib")
__author_mail__ = ("RaNaN@pyload.org", "fragonib[AT]yahoo[DOT]es")
+ TITLE_PATTERN = r'<div class="Text">Inhalt des Ordners <span(.*)>(?P<title>.+)</span></div>'
+
def decrypt(self, pyfile):
-
# Request package
self.html = self.load(pyfile.url)
-
+
# Check for password protection
if self.isPasswordProtected():
self.html = self.submitPassword()
@@ -31,54 +34,37 @@ class NetfolderIn(Crypter):
# Set package
self.packages = [(package_name, package_links, folder_name)]
-
-
+
def isPasswordProtected(self):
-
+
if '<input type="password" name="password"' in self.html:
self.logDebug("Links are password protected")
return True
return False
-
def submitPassword(self):
# Gather data
try:
m = re.match(self.__pattern__, self.pyfile.url)
- id = max(m.group('id1'), m.group('id2'))
+ id = max(m.group('id1'), m.group('id2'))
except AttributeError:
self.logDebug("Unable to get package id from url [%s]" % self.pyfile.url)
return
url = "http://netfolder.in/folder.php?folder_id=" + id
password = self.getPassword()
-
+
# Submit package password
- post = { 'password' : password, 'save' : 'Absenden' }
+ post = {'password': password, 'save': 'Absenden'}
self.logDebug("Submitting password [%s] for protected links with id [%s]" % (password, id))
html = self.load(url, {}, post)
-
+
# Check for invalid password
if '<div class="InPage_Error">' in html:
self.logDebug("Incorrect password, please set right password on Edit package form and retry")
return None
-
- return html
-
-
- def getPackageNameAndFolder(self):
- title_re = r'<div class="Text">Inhalt des Ordners <span(.*)>(?P<title>.+)</span></div>'
- m = re.search(title_re, self.html)
- if m is not None:
- name = folder = m.group('title')
- self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
- return name, folder
- else:
- name = self.pyfile.package().name
- folder = self.pyfile.package().folder
- self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
- return name, folder
-
-
+
+ return html
+
def getLinks(self):
links = re.search(r'name="list" value="(.*?)"', self.html).group(1).split(",")
self.logDebug("Package has %d links" % len(links))
diff --git a/module/plugins/crypter/SpeedLoadOrgFolder.py b/module/plugins/crypter/SpeedLoadOrgFolder.py
index 5b350787f..f85ede6f3 100644
--- a/module/plugins/crypter/SpeedLoadOrgFolder.py
+++ b/module/plugins/crypter/SpeedLoadOrgFolder.py
@@ -1,5 +1,20 @@
# -*- 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/>. #
+############################################################################
+
from module.plugins.internal.SimpleCrypter import SimpleCrypter
class SpeedLoadOrgFolder(SimpleCrypter):
diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py
index c6672ea8c..814d5240d 100644
--- a/module/plugins/crypter/UlozToFolder.py
+++ b/module/plugins/crypter/UlozToFolder.py
@@ -7,7 +7,7 @@ class UlozToFolder(Crypter):
__name__ = "UlozToFolder"
__type__ = "crypter"
__pattern__ = r"http://.*(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(m|soubory)/.*"
- __version__ = "0.1a"
+ __version__ = "0.2"
__description__ = """Uloz.to Folder Plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py
index d4534297e..c514f23d0 100644
--- a/module/plugins/crypter/UploadedToFolder.py
+++ b/module/plugins/crypter/UploadedToFolder.py
@@ -1,13 +1,30 @@
# -*- coding: utf-8 -*-
-from module.plugins.Crypter import Crypter
+############################################################################
+# 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/>. #
+############################################################################
+
import re
-class UploadedToFolder(Crypter):
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class UploadedToFolder(SimpleCrypter):
__name__ = "UploadedToFolder"
__type__ = "crypter"
- __pattern__ = r"http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|list)/(?P<id>\w+)"
- __version__ = "0.1"
+ __pattern__ = r"http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<id>\w+)"
+ __version__ = "0.3"
__description__ = """UploadedTo Crypter Plugin"""
__author_name__ = ("stickell")
__author_mail__ = ("l.stickell@yahoo.it")
@@ -31,15 +48,3 @@ class UploadedToFolder(Crypter):
self.logDebug('Package has %d links' % len(package_links))
self.packages = [(package_name, package_links, folder_name)]
-
- def getPackageNameAndFolder(self):
- m = re.search(self.TITLE_PATTERN, self.html)
- if m:
- name = folder = m.group('title')
- self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
- return name, folder
- else:
- name = self.pyfile.package().name
- folder = self.pyfile.package().folder
- self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
- return name, folder
diff --git a/module/plugins/crypter/YoutubeBatch.py b/module/plugins/crypter/YoutubeBatch.py
index 2e68dfe02..567191bb9 100644
--- a/module/plugins/crypter/YoutubeBatch.py
+++ b/module/plugins/crypter/YoutubeBatch.py
@@ -2,26 +2,41 @@
# -*- coding: utf-8 -*-
import re
+import json
from module.plugins.Crypter import Crypter
+API_KEY = "AIzaSyCKnWLNlkX-L4oD1aEzqqhRw1zczeD6_k0"
+
class YoutubeBatch(Crypter):
__name__ = "YoutubeBatch"
__type__ = "container"
- __pattern__ = r"http://(?:[^/]*?)youtube\.com/((?:view_play_list|playlist|.*?feature=PlayList).*?[\?&](?:list|p)=|user/)(\w+)"
+ __pattern__ = r"http://(?:[^/]*?)youtube\.com/((?:view_play_list|playlist|.*?feature=PlayList).*?[\?&](?:list|p)=)([a-zA-Z0-9-_]+)"
__version__ = "0.92"
__description__ = """Youtube.com Channel Download Plugin"""
- __author_name__ = ("RaNaN", "Spoob", "zoidberg")
- __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "zoidberg@mujmail.cz")
+ __author_name__ = ("RaNaN", "Spoob", "zoidberg", "roland")
+ __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "zoidberg@mujmail.cz", "roland@enkore.de")
+
+ def get_videos(self, playlist_id, token=None):
+ url = "https://www.googleapis.com/youtube/v3/playlistItems?playlistId=%s&part=snippet&key=%s&maxResults=50" % (playlist_id, API_KEY)
+ if token:
+ url += "&pageToken=" + token
+
+ response = json.loads(self.load(url))
+
+ for item in response["items"]:
+ if item["kind"] == "youtube#playlistItem" and item["snippet"]["resourceId"]["kind"] == "youtube#video":
+ yield "http://youtube.com/watch?v=" + item["snippet"]["resourceId"]["videoId"]
+
+ if "nextPageToken" in response:
+ for item in self.get_videos(playlist_id, response["nextPageToken"]):
+ yield item
def decrypt(self, pyfile):
match_id = re.match(self.__pattern__, self.pyfile.url)
- if match_id.group(1) == "user/":
- url = "http://gdata.youtube.com/feeds/api/users/%s/uploads?v=2" % match_id.group(2)
- else:
- url = "http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % match_id.group(2)
-
- rep = self.load(url)
new_links = []
- new_links.extend(re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)&", rep))
+ playlist_id = match_id.group(2)
+
+ new_links.extend(self.get_videos(playlist_id))
+
self.packages.append((self.pyfile.package().name, new_links, self.pyfile.package().name))