diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/ShareRapidCom.py | 27 | ||||
-rw-r--r-- | module/plugins/crypter/SerienjunkiesOrg.py | 261 |
2 files changed, 198 insertions, 90 deletions
diff --git a/module/plugins/accounts/ShareRapidCom.py b/module/plugins/accounts/ShareRapidCom.py index a14f93a9c..178fe236e 100644 --- a/module/plugins/accounts/ShareRapidCom.py +++ b/module/plugins/accounts/ShareRapidCom.py @@ -5,32 +5,29 @@ from module.plugins.Account import Account class ShareRapidCom(Account): __name__ = "ShareRapidCom" - __version__ = "0.2" + __version__ = "0.3" __type__ = "account" __description__ = """ShareRapid account plugin""" __author_name__ = ("MikyWoW") def loadAccountInfo(self, user, req): src = req.load("http://share-rapid.com/mujucet/", cookies=True) - if "Kredit:" in src: - start = src.index('Kredit:</td><td>') - src = src[start+16:] - start = src.index('GB') - kredit = src[0:start-1] - ret = float(kredit)*1024*1024 - tmp = {"premium": True, "trafficleft": ret, "validuntil": -1} + found = re.search(r'<tr><td>GB:</td><td>(.*?) GB', src) + if found: + ret = float(found.group(1)) * (1 << 20) + tmp = {"premium": True, "trafficleft": ret, "validuntil": -1} else: - tmp = {"premium": False, "trafficleft": None, "validuntil": None} + tmp = {"premium": False, "trafficleft": None, "validuntil": None} return tmp def login(self, user, data, req): htm = req.load("http://share-rapid.com/prihlaseni/", cookies=True) if "Heslo:" in htm: - start = htm.index('id="inp_hash" name="hash" value="') - htm = htm[start+33:] - hashes = htm[0:32] - htm = req.load("http://share-rapid.com/prihlaseni/", + start = htm.index('id="inp_hash" name="hash" value="') + htm = htm[start+33:] + hashes = htm[0:32] + htm = req.load("http://share-rapid.com/prihlaseni/", post={"hash": hashes,"login": user, "pass1": data["password"],"remember": 0, "sbmt": "P%C5%99ihl%C3%A1sit"}, cookies=True) - if "Heslo:" in htm: - self.wrongPassword()
\ No newline at end of file + if "Heslo:" in htm: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/crypter/SerienjunkiesOrg.py b/module/plugins/crypter/SerienjunkiesOrg.py index 2178f5300..d76765632 100644 --- a/module/plugins/crypter/SerienjunkiesOrg.py +++ b/module/plugins/crypter/SerienjunkiesOrg.py @@ -2,7 +2,7 @@ import re from time import sleep - +import random from module.plugins.Crypter import Crypter from module.lib.BeautifulSoup import BeautifulSoup from module.unescape import unescape @@ -10,36 +10,23 @@ from module.unescape import unescape class SerienjunkiesOrg(Crypter): __name__ = "SerienjunkiesOrg" __type__ = "container" - __pattern__ = r"http://.*?serienjunkies.org/.*?" - __version__ = "0.31" - __config__ = [("preferredHoster", "str", "preferred hoster", - "RapidshareCom,UploadedTo,NetloadIn,FilefactoryCom,FreakshareNet,FilebaseTo,MegauploadCom,HotfileCom,DepositfilesCom,EasyshareCom,KickloadCom") - , - ("changeName", "bool", "Take SJ.org episode name", "True")] + __pattern__ = r"http://.*?(serienjunkies.org|dokujunkies.org)/.*?" + __version__ = "0.34" + __config__ = [ + ("changeNameSJ", "Packagename;Show;Season;Format;Episode", "Take SJ.org name", "Show"), + ("changeNameDJ", "Packagename;Show;Format;Episode", "Take DJ.org name", "Show"), + ("randomPreferred", "bool", "Randomize Preferred-List", False), + ("hosterListMode", "OnlyOne;OnlyPreferred(One);OnlyPreferred(All);All", "Use for hosters (if supported)", "All"), + ("hosterList", "str", "Preferred Hoster list (comma separated)", "RapidshareCom,UploadedTo,NetloadIn,FilefactoryCom,FreakshareNet,FilebaseTo,MegauploadCom,HotfileCom,DepositfilesCom,EasyshareCom,KickloadCom"), + ("ignoreList", "str", "Ignored Hoster list (comma separated)", "MegauploadCom") + ] __description__ = """serienjunkies.org Container Plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") + __author_name__ = ("mkaay", "godofdream") + __author_mail__ = ("mkaay@mkaay.de", "soilfiction@gmail.com") - def setup(self): - self.hosterMap = { - "rc": "RapidshareCom", - "ff": "FilefactoryCom", - "ut": "UploadedTo", - "ul": "UploadedTo", - "nl": "NetloadIn", - "fs": "FreakshareNet", - "fb": "FilebaseTo", - "mu": "MegauploadCom", - "hf": "HotfileCom", - "df": "DepositfilesCom", - "es": "EasyshareCom", - "kl": "KickloadCom", - "fc": "FilesonicCom", - } - self.hosterMapReverse = dict((v, k) for k, v in self.hosterMap.iteritems()) + def setup(self): self.multiDL = False - self.limitDL = 4 def getSJSrc(self, url): src = self.req.load(str(url)) @@ -51,72 +38,80 @@ class SerienjunkiesOrg(Crypter): def handleShow(self, url): src = self.getSJSrc(url) soup = BeautifulSoup(src) + packageName = self.pyfile.package().name + if self.getConfig("changeNameSJ") == "Show": + found = unescape(soup.find("h2").find("a").string.split(' –')[0]) + if found: + packageName = found + nav = soup.find("div", attrs={"id": "scb"}) + + package_links = [] for a in nav.findAll("a"): - self.packages.append((unescape(a.text), [a["href"]], unescape(a.text))) + package_links.append(a["href"]) + if self.getConfig("changeNameSJ") == "Packagename": + self.core.files.addLinks(package_links, self.pyfile.package().id) + else: + self.packages.append((packageName, package_links, packageName)) def handleSeason(self, url): src = self.getSJSrc(url) soup = BeautifulSoup(src) post = soup.find("div", attrs={"class": "post-content"}) ps = post.findAll("p") - hosterPattern = re.compile("^http://download\.serienjunkies\.org/f-.*?/([rcfultns]{2})_.*?\.html$") - preferredHoster = self.getConfig("preferredHoster").split(",") - self.log.debug("Preferred hoster: %s" % ", ".join(preferredHoster)) + + seasonName = unescape(soup.find("a", attrs={"rel": "bookmark"}).string).replace("–", "-") groups = {} gid = -1 - seasonName = unescape(soup.find("a", attrs={"rel": "bookmark"}).string) for p in ps: - if re.search("<strong>Dauer|<strong>Sprache|<strong>Format", str(p)): + if re.search("<strong>Sprache|<strong>Format", str(p)): var = p.findAll("strong") - opts = {"Dauer": "", "Uploader": "", "Sprache": "", "Format": "", u"Größe": ""} + opts = {"Sprache": "", "Format": ""} for v in var: - n = unescape(v.string) - n = n.strip() + n = unescape(v.string).strip() n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n) if n.strip() not in opts: continue val = v.nextSibling if not val: continue - val = val.encode("utf-8") - val = unescape(val) val = val.replace("|", "").strip() - val = val.strip() val = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', val) opts[n.strip()] = val.strip() gid += 1 groups[gid] = {} - groups[gid]["ep"] = [] + groups[gid]["ep"] = {} groups[gid]["opts"] = opts elif re.search("<strong>Download:", str(p)): - links1 = p.findAll("a", attrs={"href": hosterPattern}) - links2 = p.findAll("a", attrs={"href": re.compile("^http://serienjunkies.org/safe/.*$")}) - for link in links1 + links2: - groups[gid]["ep"].append(link["href"]) + parts = str(p).split("<br />") + if re.search("<strong>", parts[0]): + ename = re.search('<strong>(.*?)</strong>',parts[0]).group(1).strip().decode("utf-8").replace("–", "-") + groups[gid]["ep"][ename] = {} + parts.remove(parts[0]) + for part in parts: + hostername = re.search(" \| ([-a-zA-Z0-9]+\.\w+)",part) + if hostername: + hostername = hostername.group(1) + groups[gid]["ep"][ename][hostername] = [] + links = re.findall('href="(.*?)"',part) + for link in links: + groups[gid]["ep"][ename][hostername].append(link) + + links = [] for g in groups.values(): - links = [] - linklist = g["ep"] + for ename in g["ep"]: + links.extend(self.getpreferred(g["ep"][ename])) + if self.getConfig("changeNameSJ") == "Episode": + self.packages.append((ename, links, ename)) + links = [] package = "%s (%s, %s)" % (seasonName, g["opts"]["Format"], g["opts"]["Sprache"]) - linkgroups = {} - for link in linklist: - key = re.sub("^http://download\.serienjunkies\.org/f-.*?/(.{2})_", "", link) - if key not in linkgroups: - linkgroups[key] = [] - linkgroups[key].append(link) - for group in linkgroups.values(): - for pHoster in preferredHoster: - hmatch = False - for link in group: - m = hosterPattern.match(link) - if m: - if pHoster == self.hosterMap[m.group(1)]: - links.append(link) - hmatch = True - break - if hmatch: - break - self.packages.append((package, links, package)) + if self.getConfig("changeNameSJ") == "Format": + self.packages.append((package, links, package)) + links = [] + if self.getConfig("changeNameSJ") == "Season": + self.packages.append((seasonName, links, seasonName)) + elif links != []: + self.core.files.addLinks(links, self.pyfile.package().id) def handleEpisode(self, url): src = self.getSJSrc(url) @@ -127,11 +122,14 @@ class SerienjunkiesOrg(Crypter): soup = BeautifulSoup(src) form = soup.find("form") h1 = soup.find("h1") - packageName = h1.text + + packageName = self.pyfile.package().name + + if h1.get("class") == "wrap": captchaTag = soup.find(attrs={"src": re.compile("^/secure/")}) if not captchaTag: - sleep(1) + sleep(5) self.retry() captchaUrl = "http://download.serienjunkies.org" + captchaTag["src"] @@ -155,12 +153,7 @@ class SerienjunkiesOrg(Crypter): for link in rawLinks: frameUrl = link["action"].replace("/go-", "/frame/go-") links.append(self.handleFrame(frameUrl)) - - # thx gartd6oDLobo - if not self.getConfig("changeName"): - packageName = self.pyfile.package().name - - self.packages.append((packageName, links, packageName)) + self.core.files.addLinks(links, self.pyfile.package().id) def handleOldStyleLink(self, url): sj = self.req.load(str(url)) @@ -177,18 +170,99 @@ class SerienjunkiesOrg(Crypter): decrypted = self.req.lastEffectiveURL if decrypted == str(url): self.retry() - self.packages.append((self.pyfile.package().name, [decrypted], self.pyfile.package().folder)) + self.core.files.addLinks([decrypted], self.pyfile.package().id) def handleFrame(self, url): self.req.load(str(url)) return self.req.lastEffectiveURL + def handleShowDJ(self, url): + src = self.getSJSrc(url) + soup = BeautifulSoup(src) + post = soup.find("div", attrs={"id": "page_post"}) + ps = post.findAll("p") + found = unescape(soup.find("h2").find("a").string.split(' –')[0]) + if found: + seasonName = found + + groups = {} + gid = -1 + for p in ps: + if re.search("<strong>Sprache|<strong>Format", str(p)): + var = p.findAll("strong") + opts = {"Sprache": "", "Format": ""} + for v in var: + n = unescape(v.string).strip() + n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n) + if n.strip() not in opts: + continue + val = v.nextSibling + if not val: + continue + val = val.replace("|", "").strip() + val = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', val) + opts[n.strip()] = val.strip() + gid += 1 + groups[gid] = {} + groups[gid]["ep"] = {} + groups[gid]["opts"] = opts + elif re.search("<strong>Download:", str(p)): + parts = str(p).split("<br />") + if re.search("<strong>", parts[0]): + ename = re.search('<strong>(.*?)</strong>',parts[0]).group(1).strip().decode("utf-8").replace("–", "-") + groups[gid]["ep"][ename] = {} + parts.remove(parts[0]) + for part in parts: + hostername = re.search(" \| ([-a-zA-Z0-9]+\.\w+)",part) + if hostername: + hostername = hostername.group(1) + groups[gid]["ep"][ename][hostername] = [] + links = re.findall('href="(.*?)"',part) + for link in links: + groups[gid]["ep"][ename][hostername].append(link) + + links = [] + for g in groups.values(): + for ename in g["ep"]: + links.extend(self.getpreferred(g["ep"][ename])) + if self.getConfig("changeNameDJ") == "Episode": + self.packages.append((ename, links, ename)) + links = [] + package = "%s (%s, %s)" % (seasonName, g["opts"]["Format"], g["opts"]["Sprache"]) + if self.getConfig("changeNameDJ") == "Format": + self.packages.append((package, links, package)) + links = [] + if self.getConfig("changeNameDJ") == "Show": + self.packages.append((seasonName, links, seasonName)) + links = [] + elif links != []: + self.core.files.addLinks(links, self.pyfile.package().id) + + + + + + + + + + def handleCategoryDJ(self, url): + package_links = [] + src = self.getSJSrc(url) + soup = BeautifulSoup(src) + content = soup.find("div", attrs={"id": "content"}) + for a in content.findAll("a", attrs={"rel": "bookmark"}): + package_links.append(a["href"]) + self.core.files.addLinks(package_links, self.pyfile.package().id) + def decrypt(self, pyfile): showPattern = re.compile("^http://serienjunkies.org/serie/(.*)/$") seasonPattern = re.compile("^http://serienjunkies.org/.*?/(.*)/$") episodePattern = re.compile("^http://download.serienjunkies.org/f-.*?.html$") oldStyleLink = re.compile("^http://serienjunkies.org/safe/(.*)$") - framePattern = re.compile("^http://download.serienjunkies.org/frame/go-.*?/$") + categoryPatternDJ = re.compile("^http://dokujunkies.org/.*?(.*)$") + showPatternDJ = re.compile("^http://dokujunkies.org/.*?/(.*)\.html$") + framePattern = re.compile("^http://download.(serienjunkies.org|dokujunkies.org)/frame/go-.*?/$") url = pyfile.url if framePattern.match(url): self.packages.append((self.pyfile.package().name, [self.handleFrame(url)], self.pyfile.package().name)) @@ -198,5 +272,42 @@ class SerienjunkiesOrg(Crypter): self.handleOldStyleLink(url) elif showPattern.match(url): self.handleShow(url) + elif showPatternDJ.match(url): + self.handleShowDJ(url) elif seasonPattern.match(url): self.handleSeason(url) + elif categoryPatternDJ.match(url): + self.handleCategoryDJ(url) + + #selects the preferred hoster, after that selects any hoster (ignoring the one to ignore) + def getpreferred(self, hosterlist): + + result = [] + preferredList = self.getConfig("hosterList").strip().lower().replace('|',',').replace('.','').replace(';',',').split(',') + if (self.getConfig("randomPreferred") == True) and (self.getConfig("hosterListMode") in ["OnlyOne","OnlyPreferred(One)"]) : + random.shuffle(preferredList) + # we don't want hosters be read two times + hosterlist2 = hosterlist.copy() + + for preferred in preferredList: + for Hoster in hosterlist: + if preferred == Hoster.lower().replace('.',''): + for Part in hosterlist[Hoster]: + self.logDebug("selected " + Part) + result.append(str(Part)) + del(hosterlist2[Hoster]) + if (self.getConfig("hosterListMode") in ["OnlyOne","OnlyPreferred(One)"]): + return result + + + ignorelist = self.getConfig("ignoreList").strip().lower().replace('|',',').replace('.','').replace(';',',').split(',') + if self.getConfig('hosterListMode') in ["OnlyOne","All"]: + for Hoster in hosterlist2: + if Hoster.strip().lower().replace('.','') not in ignorelist: + for Part in hosterlist2[Hoster]: + self.logDebug("selected2 " + Part) + result.append(str(Part)) + + if self.getConfig('hosterListMode') == "OnlyOne": + return result + return result |