summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/plugins/crypter/GooGl.py26
-rw-r--r--module/plugins/crypter/LinkSaveIn.py7
-rw-r--r--module/plugins/internal/SimpleDereferer.py10
-rw-r--r--module/plugins/internal/SimpleHoster.py2
4 files changed, 24 insertions, 21 deletions
diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py
index b5f0c0447..4cea66d2a 100644
--- a/module/plugins/crypter/GooGl.py
+++ b/module/plugins/crypter/GooGl.py
@@ -1,32 +1,32 @@
# -*- coding: utf-8 -*-
-from module.plugins.Crypter import Crypter
+from module.plugins.internal.SimpleDereferer import SimpleDereferer, create_getInfo
from module.common.json_layer import json_loads
-class GooGl(Crypter):
+class GooGl(SimpleDereferer):
__name__ = "GooGl"
__type__ = "crypter"
- __version__ = "0.01"
+ __version__ = "0.02"
- __pattern__ = r'https?://(?:www\.)?goo\.gl/\w+'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ __pattern__ = r'https?://(?:www\.)?goo\.gl/(\w+/)?\w+'
__description__ = """Goo.gl decrypter plugin"""
__license__ = "GPLv3"
- __authors__ = [("stickell", "l.stickell@yahoo.it")]
+ __authors__ = [("stickell" , "l.stickell@yahoo.it"),
+ ("Walter Purcaro", "vuolter@gmail.com" )]
API_URL = "https://www.googleapis.com/urlshortener/v1/url"
+ OFFLINE_PATTERN = r'has been disabled|does not exist'
- def decrypt(self, pyfile):
- rep = self.load(self.API_URL, get={'shortUrl': pyfile.url})
+
+ def getLink(self):
+ rep = self.load(self.API_URL, get={'shortUrl': self.pyfile.url})
self.logDebug("JSON data: " + rep)
rep = json_loads(rep)
+ return rep['longUrl'] if "longUrl" in rep else None
+
- if 'longUrl' in rep:
- self.urls = [rep['longUrl']]
- else:
- self.fail(_("Unable to expand shortened link"))
+getInfo = create_getInfo(GooGl)
diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py
index 040305bd9..95652096d 100644
--- a/module/plugins/crypter/LinkSaveIn.py
+++ b/module/plugins/crypter/LinkSaveIn.py
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
-from module.plugins.internal.SimpleDereferer import SimpleDereferer
+from module.plugins.internal.SimpleDereferer import SimpleDereferer, create_getInfo
class LinkSaveIn(SimpleDereferer):
__name__ = "LinkSaveIn"
__type__ = "crypter"
- __version__ = "2.03"
+ __version__ = "2.04"
__pattern__ = r'https?://(?:www\.)?linksave\.in/\w+'
__config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
@@ -20,3 +20,6 @@ class LinkSaveIn(SimpleDereferer):
COOKIES = [("linksave.in", "Linksave_Language", "english")]
OFFLINE_PATTERN = r'>(Error )?404 -'
+
+
+getInfo = create_getInfo(LinkSaveIn)
diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py
index fad1559c7..3a5f21900 100644
--- a/module/plugins/internal/SimpleDereferer.py
+++ b/module/plugins/internal/SimpleDereferer.py
@@ -4,17 +4,17 @@ import re
import urllib
from module.plugins.Crypter import Crypter
-from module.plugins.internal.SimpleHoster import getFileURL, set_cookies
+from module.plugins.internal.SimpleHoster import create_getInfo, getFileURL, set_cookies
+from module.utils import html_unescape
class SimpleDereferer(Crypter):
__name__ = "SimpleDereferer"
__type__ = "crypter"
- __version__ = "0.11"
+ __version__ = "0.12"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ __config__ = [] #@TODO: Remove in 0.4.10
__description__ = """Simple dereferer plugin"""
__license__ = "GPLv3"
@@ -91,7 +91,7 @@ class SimpleDereferer(Crypter):
def getLink(self):
try:
- return re.search(self.LINK_PATTERN, self.html).group(1)
+ return html_unescape(re.search(self.LINK_PATTERN, self.html).group(1).decode('unicode-escape')) #@TODO: Move this check to plugin `load` method in 0.4.10
except Exception:
pass
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index d3c269548..0a9986d4c 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -509,7 +509,7 @@ class SimpleHoster(Hoster):
self.correctCaptcha()
- link = html_unescape(link.decode('unicode-escape')) #@TODO: Move this check to plugin `load` method
+ link = html_unescape(link.decode('unicode-escape')) #@TODO: Move this check to plugin `load` method in 0.4.10
if not urlparse.urlparse(link).scheme:
url_p = urlparse.urlparse(self.pyfile.url)