summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/crypter/C1neonCom.py127
-rw-r--r--module/plugins/hoster/PutlockerCom.py46
2 files changed, 33 insertions, 140 deletions
diff --git a/module/plugins/crypter/C1neonCom.py b/module/plugins/crypter/C1neonCom.py
index 7d20d8a73..c1e9013b3 100644
--- a/module/plugins/crypter/C1neonCom.py
+++ b/module/plugins/crypter/C1neonCom.py
@@ -1,136 +1,13 @@
# -*- 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.
+from module.plugins.internal.DeadCrypter import DeadCrypter
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
- @author: godofdream
-"""
-
-import re
-import random
-from module.plugins.Crypter import Crypter
-from module.common.json_layer import json_loads
-
-
-class C1neonCom(Crypter):
+class C1neonCom(DeadCrypter):
__name__ = "C1neonCom"
__type__ = "container"
__pattern__ = r"http://(www\.)?c1neon.com/.*?"
__version__ = "0.05"
- __config__ = [
- ("changeNameS", "Packagename;Show;Season;Episode", "Rename Show by", "Show"),
- ("changeName", "Packagename;Movie", "Rename Movie by", "Movie"),
- ("useStreams", "bool", "Use Streams too", False),
- ("hosterListMode", "all;onlypreferred", "Use for hosters (if supported)", "all"),
- ("randomPreferred", "bool", "Randomize Preferred-List", False),
- ("hosterList", "str", "Preferred Hoster list (comma separated, no ending)",
- "2shared,Bayfiles,Netload,Rapidshare,Share-online"),
- ("ignoreList", "str", "Ignored Hoster list (comma separated, no ending)", "Megaupload")
- ]
__description__ = """C1neon.Com Container Plugin"""
__author_name__ = ("godofdream")
__author_mail__ = ("soilfiction@gmail.com")
-
- VALUES_PATTERN = r"var subcats = (.*?)(;</script>|;var)"
- SHOW_PATTERN = r"title='(.*?)'"
- SERIE_PATTERN = r"<title>.*Serie.*</title>"
-
- def decrypt(self, pyfile):
- src = self.req.load(str(pyfile.url))
-
- pattern = re.compile(self.VALUES_PATTERN, re.DOTALL)
- data = json_loads(re.search(pattern, src).group(1))
-
- # Get package info
- links = []
- Showname = re.search(self.SHOW_PATTERN, src)
- if Showname:
- Showname = Showname.group(1).decode("utf-8")
- else:
- Showname = self.pyfile.package().name
-
- if re.search(self.SERIE_PATTERN, src):
- for Season in data:
- self.logDebug("Season " + Season)
- for Episode in data[Season]:
- self.logDebug("Episode " + Episode)
- links.extend(self.getpreferred(data[Season][Episode]))
- if self.getConfig("changeNameS") == "Episode":
- self.packages.append((data[Season][Episode]['info']['name'].split("»")[0], links,
- data[Season][Episode]['info']['name'].split("»")[0]))
- links = []
-
- if self.getConfig("changeNameS") == "Season":
- self.packages.append((Showname + " Season " + Season, links, Showname + " Season " + Season))
- links = []
-
- if self.getConfig("changeNameS") == "Show":
- if links == []:
- self.fail('Could not extract any links (Out of Date?)')
- else:
- self.packages.append((Showname, links, Showname))
-
- elif self.getConfig("changeNameS") == "Packagename":
- if links == []:
- self.fail('Could not extract any links (Out of Date?)')
- else:
- self.core.files.addLinks(links, self.pyfile.package().id)
- else:
- for Movie in data:
- links.extend(self.getpreferred(data[Movie]))
- if self.getConfig("changeName") == "Movie":
- if links == []:
- self.fail('Could not extract any links (Out of Date?)')
- else:
- self.packages.append((Showname, links, Showname))
-
- elif self.getConfig("changeName") == "Packagename":
- if links == []:
- self.fail('Could not extract any links (Out of Date?)')
- else:
- self.core.files.addLinks(links, self.pyfile.package().id)
-
- #selects the preferred hoster, after that selects any hoster (ignoring the one to ignore)
- #selects only one Hoster
- def getpreferred(self, hosterslist):
- hosterlist = {}
- if 'u' in hosterslist:
- hosterlist.update(hosterslist['u'])
- if ('d' in hosterslist):
- hosterlist.update(hosterslist['d'])
- if self.getConfig("useStreams") and 's' in hosterslist:
- hosterlist.update(hosterslist['s'])
-
- result = []
- preferredList = self.getConfig("hosterList").strip().lower().replace(
- '|',',').replace('.', '').replace(';', ',').split(',')
- if self.getConfig("randomPreferred") == True:
- random.shuffle(preferredList)
- for preferred in preferredList:
- for Hoster in hosterlist:
- if preferred == Hoster.split('<')[0].strip().lower().replace('.', ''):
- for Part in hosterlist[Hoster]:
- self.logDebug("selected " + Part[3])
- result.append(str(Part[3]))
- return result
-
- ignorelist = self.getConfig("ignoreList").strip().lower().replace(
- '|', ',').replace('.', '').replace(';', ',').split( ',')
- if self.getConfig('hosterListMode') == "all":
- for Hoster in hosterlist:
- if Hoster.split('<')[0].strip().lower().replace('.', '') not in ignorelist:
- for Part in hosterlist[Hoster]:
- self.logDebug("selected " + Part[3])
- result.append(str(Part[3]))
- return result
- return result
diff --git a/module/plugins/hoster/PutlockerCom.py b/module/plugins/hoster/PutlockerCom.py
index 8d1305820..0b049b28d 100644
--- a/module/plugins/hoster/PutlockerCom.py
+++ b/module/plugins/hoster/PutlockerCom.py
@@ -18,6 +18,7 @@
"""
import re
+from os import rename
from module.plugins.internal.SimpleHoster import SimpleHoster
@@ -26,25 +27,26 @@ class PutlockerCom(SimpleHoster):
__name__ = "PutlockerCom"
__type__ = "hoster"
__pattern__ = r'http://(www\.)?putlocker\.com/(file|embed)/[A-Z0-9]+'
- __version__ = "0.28"
+ __version__ = "0.29"
__description__ = """Putlocker.Com"""
- __author_name__ = ("jeix", "stickell")
- __author_mail__ = ("l.stickell@yahoo.it")
+ __author_name__ = ("jeix", "stickell", "Walter Purcaro")
+ __author_mail__ = ("", "l.stickell@yahoo.it", "vuolter@gmail.com")
FILE_OFFLINE_PATTERN = r"This file doesn't exist, or has been removed."
FILE_INFO_PATTERN = r'site-content">\s*<h1>(?P<N>.+)<strong>\( (?P<S>[^)]+) \)</strong></h1>'
- def handleFree(self):
+ FILE_URL_REPLACEMENTS = [(r'http://putlocker\.com', r'http://www.putlocker.com')]
+
+ def setup(self):
self.multiDL = self.resumeDownload = True
self.chunkLimit = -1
- self.pyfile.url = re.sub(r'http://putlocker\.com', r'http://www.putlocker.com', self.pyfile.url)
-
- self.html = self.load(self.pyfile.url, decode=True)
+ def handleFree(self):
+ name = self.pyfile.name
link = self._getLink()
- if not link.startswith('http://'):
- link = "http://www.putlocker.com" + link
- self.download(link)
+ self.logDebug("Direct link: " + link)
+ self.download(link, disposition=True)
+ self.processName(name)
def _getLink(self):
hash_data = re.search(r'<input type="hidden" value="([a-z0-9]+)" name="hash">', self.html)
@@ -54,12 +56,12 @@ class PutlockerCom(SimpleHoster):
post_data = {"hash": hash_data.group(1), "confirm": "Continue+as+Free+User"}
self.html = self.load(self.pyfile.url, post=post_data)
if ">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html or \
- "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html:
- self.retry(wait_time=2 * 60 * 60, reason="Download limit exceeded or server disabled")
+ "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html:
+ self.retry(wait_time=7200, reason="Download limit exceeded or server disabled") # 2 hours wait
patterns = (r'(/get_file\.php\?id=[A-Z0-9]+&key=[A-Za-z0-9=]+&original=1)',
- r"(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)",
- r"(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+&original=1)",
+ r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)',
+ r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+&original=1)',
r'<a href="/gopro\.php">Tired of ads and waiting\? Go Pro!</a>[\t\n\rn ]+</div>[\t\n\rn ]+<a href="(/.*?)"')
for pattern in patterns:
link = re.search(pattern, self.html)
@@ -75,4 +77,18 @@ class PutlockerCom(SimpleHoster):
else:
self.parseError('Unable to detect a download link')
- return link.group(1).replace("&amp;", "&")
+ link = link.group(1).replace("&amp;", "&")
+ if link.startswith("http://"):
+ return link
+ else:
+ return "http://www.putlocker.com" + link
+
+ def processName(self, name_old):
+ name = self.pyfile.name
+ if name <= name_old:
+ return
+ name_new = re.sub(r'\.[^.]+$', "", name_old) + name[len(name_old):]
+ file = self.lastDownload
+ self.pyfile.name = name_new
+ rename(file, file.rsplit(name)[0] + name_new)
+ self.logInfo("%(name)s renamed to %(newname)s" % {"name": name, "newname": name_new})