summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/crypter/SexuriaCom.py63
1 files changed, 37 insertions, 26 deletions
diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py
index 7942d5e42..a7448cd4c 100644
--- a/module/plugins/crypter/SexuriaCom.py
+++ b/module/plugins/crypter/SexuriaCom.py
@@ -1,25 +1,23 @@
# -*- coding: utf-8 -*-
import re
-
from module.plugins.internal.Crypter import Crypter
-
class SexuriaCom(Crypter):
__name__ = "SexuriaCom"
__type__ = "crypter"
- __version__ = "0.04"
+ __version__ = "0.10"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ __config__ = [("use_subfolder", "bool", "Save package to subfolder" , True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Sexuria.com decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("NETHead", "NETHead.AT.gmx.DOT.net")]
-
+ #: Constants
PATTERN_SUPPORTED_MAIN = r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html'
PATTERN_SUPPORTED_CRYPT = r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html'
PATTERN_SUPPORTED_REDIRECT = r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+'
@@ -27,15 +25,17 @@ class SexuriaCom(Crypter):
PATTERN_PASSWORD = r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>'
PATTERN_DL_LINK_PAGE = r'"(dl_links_\d+_\d+\.html)"'
PATTERN_REDIRECT_LINKS = r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly'
-
+ LIST_PWDIGNORE = ["Kein Passwort", "-"]
def decrypt(self, pyfile):
#: Init
self.pyfile = pyfile
self.package = pyfile.package()
- #: Get package links
+ #: Decrypt and add links
package_name, self.links, folder_name, package_pwd = self.decrypt_links(self.pyfile.url)
+ if package_pwd:
+ self.pyfile.package().password = package_pwd
self.packages = [(package_name, self.links, folder_name)]
@@ -61,35 +61,46 @@ class SexuriaCom(Crypter):
elif re.match(self.PATTERN_SUPPORTED_CRYPT, url, re.I):
#: Extract info from main file
id = re.search(self.PATTERN_SUPPORTED_CRYPT, url, re.I).group('ID')
- html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id)
-
- title = re.search(self.PATTERN_TITLE, html, re.I).group('TITLE').strip()
- if title:
- name = folder = title
- self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder))
-
- pwd = re.search(self.PATTERN_PASSWORD, html, re.I | re.S).group('PWD')
- if pwd and pwd not in ("Kein Passwort", "-"):
- password = pwd.strip()
- self.log_debug("Password info [%s] found" % password)
+ html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id) #, decode=True
+ #: Webpage title / Package name
+ titledata = re.search(self.PATTERN_TITLE, html, re.I)
+ if not titledata:
+ self.log_warning("No title data found, has site changed?")
+ else:
+ title = titledata.group('TITLE').strip()
+ if title:
+ name = folder = title
+ self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder))
+ #: Password
+ pwddata = re.search(self.PATTERN_PASSWORD, html, re.I | re.S)
+ if not pwddata:
+ self.log_warning("No password data found, has site changed?")
+ else:
+ pwd = pwddata.group('PWD').strip()
+ if pwd and not (pwd in self.LIST_PWDIGNORE):
+ password = pwd
+ self.log_debug("Package info found, password [%s]" % password)
- #: Process link (dl_link)
+ #: Process links (dl_link)
html = self.load(url)
links = re.findall(self.PATTERN_REDIRECT_LINKS, html, re.I)
- if len(links) == 0:
+ if not links:
self.log_error(_("Broken for link: %s") % link)
else:
for link in links:
link = link.replace("http://sexuria.com/", "http://www.sexuria.com/")
finallink = self.load(link, just_header=True)['location']
- if not finallink or "sexuria.com/" in finallink:
+ if not finallink or ("sexuria.com/" in finallink):
self.log_error(_("Broken for link: %s") % link)
else:
linklist.append(finallink)
- #: Debug log
- self.log_debug("%d supported links" % len(linklist))
- for i, link in enumerate(linklist):
- self.log_debug("Supported link %d, %s" % (i + 1, link))
+ #: Log result
+ if not linklist:
+ self.fail(_("Unable to extract links (maybe plugin out of date?)"))
+ else:
+ for i, link in enumerate(linklist):
+ self.log_debug("Supported link %d/%d: %s" % (i+1, len(linklist), link))
+ #: All done, return to caller
return name, linklist, folder, password