:// protocol for mancuniancol
parent
792823b25b
commit
ef180cc215
42
AceStream.py
42
AceStream.py
|
@ -25,7 +25,7 @@ import hashlib
|
||||||
import re
|
import re
|
||||||
import base64
|
import base64
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import gzip
|
import zlib
|
||||||
|
|
||||||
from functions import file_decode, file_encode
|
from functions import file_decode, file_encode
|
||||||
from functions import magnet_alert, log, debug
|
from functions import magnet_alert, log, debug
|
||||||
|
@ -93,19 +93,12 @@ class AceStream:
|
||||||
torrentFile = self.storageDirectory + os.sep + self.torrentFilesDirectory + os.sep + self.md5(
|
torrentFile = self.storageDirectory + os.sep + self.torrentFilesDirectory + os.sep + self.md5(
|
||||||
torrentUrl) + '.torrent'
|
torrentUrl) + '.torrent'
|
||||||
try:
|
try:
|
||||||
if not re.match("^http\:.+$", torrentUrl):
|
if not re.match("^[htps]+?://.+$|^://.+$", torrentUrl):
|
||||||
content = xbmcvfs.File(file_decode(torrentUrl), "rb").read()
|
log('xbmcvfs.File for %s' % torrentUrl)
|
||||||
|
content = xbmcvfs.File(torrentUrl, "rb").read()
|
||||||
else:
|
else:
|
||||||
request = urllib2.Request(torrentUrl)
|
log('request for %s' % torrentUrl)
|
||||||
request.add_header('Referer', torrentUrl)
|
content = self.makeRequest(torrentUrl)
|
||||||
request.add_header('Accept-encoding', 'gzip')
|
|
||||||
result = urllib2.urlopen(request)
|
|
||||||
if result.info().get('Content-Encoding') == 'gzip':
|
|
||||||
buf = StringIO(result.read())
|
|
||||||
f = gzip.GzipFile(fileobj=buf)
|
|
||||||
content = f.read()
|
|
||||||
else:
|
|
||||||
content = result.read()
|
|
||||||
|
|
||||||
localFile = xbmcvfs.File(torrentFile, "w+b")
|
localFile = xbmcvfs.File(torrentFile, "w+b")
|
||||||
localFile.write(content)
|
localFile.write(content)
|
||||||
|
@ -119,6 +112,29 @@ class AceStream:
|
||||||
self.torrentFileInfo = self.TSplayer.load_torrent(base64.b64encode(content), 'RAW')
|
self.torrentFileInfo = self.TSplayer.load_torrent(base64.b64encode(content), 'RAW')
|
||||||
return self.torrentFile
|
return self.torrentFile
|
||||||
|
|
||||||
|
def makeRequest(self, torrentUrl):
|
||||||
|
torrentUrl = re.sub('^://', 'http://', torrentUrl)
|
||||||
|
x = re.search("://(.+?)/|://(.+?)$", torrentUrl)
|
||||||
|
if x:
|
||||||
|
baseurl = x.group(1) if x.group(1) else x.group(2)
|
||||||
|
else:
|
||||||
|
baseurl =''
|
||||||
|
|
||||||
|
headers = [('User-Agent',
|
||||||
|
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||||
|
('Referer', 'http://%s/' % baseurl), ('Accept-encoding', 'gzip'), ]
|
||||||
|
|
||||||
|
opener = urllib2.build_opener()
|
||||||
|
opener.addheaders = headers
|
||||||
|
result = opener.open(torrentUrl)
|
||||||
|
if result.info().get('Content-Encoding') == 'gzip':
|
||||||
|
buf = StringIO(result.read())
|
||||||
|
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
|
||||||
|
content = decomp.decompress(buf.getvalue())
|
||||||
|
else:
|
||||||
|
content = result.read()
|
||||||
|
return content
|
||||||
|
|
||||||
def magnetToTorrent(self, magnet):
|
def magnetToTorrent(self, magnet):
|
||||||
try:
|
try:
|
||||||
from SkorbaLoader import SkorbaLoader
|
from SkorbaLoader import SkorbaLoader
|
||||||
|
|
|
@ -200,19 +200,12 @@ class AnteoLoader:
|
||||||
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
||||||
torrentFile = os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent')
|
torrentFile = os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent')
|
||||||
try:
|
try:
|
||||||
if not re.match("^http\:.+$", torrentUrl):
|
if not re.match("^[htps]+?://.+$|^://.+$", torrentUrl):
|
||||||
|
log('xbmcvfs.File for %s' % torrentUrl)
|
||||||
content = xbmcvfs.File(torrentUrl, "rb").read()
|
content = xbmcvfs.File(torrentUrl, "rb").read()
|
||||||
else:
|
else:
|
||||||
request = urllib2.Request(torrentUrl)
|
log('request for %s' % torrentUrl)
|
||||||
request.add_header('Referer', torrentUrl)
|
content = self.makeRequest(torrentUrl)
|
||||||
request.add_header('Accept-encoding', 'gzip')
|
|
||||||
result = urllib2.urlopen(request)
|
|
||||||
if result.info().get('Content-Encoding') == 'gzip':
|
|
||||||
buf = StringIO(result.read())
|
|
||||||
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
|
|
||||||
content = decomp.decompress(buf.getvalue())
|
|
||||||
else:
|
|
||||||
content = result.read()
|
|
||||||
|
|
||||||
localFile = xbmcvfs.File(torrentFile, "w+b")
|
localFile = xbmcvfs.File(torrentFile, "w+b")
|
||||||
localFile.write(content)
|
localFile.write(content)
|
||||||
|
@ -229,6 +222,29 @@ class AnteoLoader:
|
||||||
self.torrentFile = torrentFile
|
self.torrentFile = torrentFile
|
||||||
return self.torrentFile
|
return self.torrentFile
|
||||||
|
|
||||||
|
def makeRequest(self, torrentUrl):
|
||||||
|
torrentUrl = re.sub('^://', 'http://', torrentUrl)
|
||||||
|
x = re.search("://(.+?)/|://(.+?)$", torrentUrl)
|
||||||
|
if x:
|
||||||
|
baseurl = x.group(1) if x.group(1) else x.group(2)
|
||||||
|
else:
|
||||||
|
baseurl =''
|
||||||
|
|
||||||
|
headers = [('User-Agent',
|
||||||
|
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||||
|
('Referer', 'http://%s/' % baseurl), ('Accept-encoding', 'gzip'), ]
|
||||||
|
|
||||||
|
opener = urllib2.build_opener()
|
||||||
|
opener.addheaders = headers
|
||||||
|
result = opener.open(torrentUrl)
|
||||||
|
if result.info().get('Content-Encoding') == 'gzip':
|
||||||
|
buf = StringIO(result.read())
|
||||||
|
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
|
||||||
|
content = decomp.decompress(buf.getvalue())
|
||||||
|
else:
|
||||||
|
content = result.read()
|
||||||
|
return content
|
||||||
|
|
||||||
def md5(self, string):
|
def md5(self, string):
|
||||||
hasher = hashlib.md5()
|
hasher = hashlib.md5()
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -168,20 +168,12 @@ class InposLoader:
|
||||||
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
||||||
torrentFile = localize_path(os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent'))
|
torrentFile = localize_path(os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent'))
|
||||||
try:
|
try:
|
||||||
if not re.match("^http\:.+$", torrentUrl):
|
if not re.match("^[htps]+?://.+$|^://.+$", torrentUrl):
|
||||||
|
log('xbmcvfs.File for %s' % torrentUrl)
|
||||||
content = xbmcvfs.File(torrentUrl, "rb").read()
|
content = xbmcvfs.File(torrentUrl, "rb").read()
|
||||||
else:
|
else:
|
||||||
request = urllib2.Request(torrentUrl)
|
log('request for %s' % torrentUrl)
|
||||||
request.add_header('Referer', torrentUrl)
|
content = self.makeRequest(torrentUrl)
|
||||||
request.add_header('Accept-encoding', 'gzip')
|
|
||||||
result = urllib2.urlopen(request)
|
|
||||||
if result.info().get('Content-Encoding') == 'gzip':
|
|
||||||
buf = StringIO(result.read())
|
|
||||||
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
|
|
||||||
content = decomp.decompress(buf.getvalue())
|
|
||||||
else:
|
|
||||||
content = result.read()
|
|
||||||
|
|
||||||
localFile = xbmcvfs.File(torrentFile, "w+b")
|
localFile = xbmcvfs.File(torrentFile, "w+b")
|
||||||
localFile.write(content)
|
localFile.write(content)
|
||||||
localFile.close()
|
localFile.close()
|
||||||
|
@ -197,6 +189,29 @@ class InposLoader:
|
||||||
self.torrentFile = torrentFile
|
self.torrentFile = torrentFile
|
||||||
return self.torrentFile
|
return self.torrentFile
|
||||||
|
|
||||||
|
def makeRequest(self, torrentUrl):
|
||||||
|
torrentUrl = re.sub('^://', 'http://', torrentUrl)
|
||||||
|
x = re.search("://(.+?)/|://(.+?)$", torrentUrl)
|
||||||
|
if x:
|
||||||
|
baseurl = x.group(1) if x.group(1) else x.group(2)
|
||||||
|
else:
|
||||||
|
baseurl =''
|
||||||
|
|
||||||
|
headers = [('User-Agent',
|
||||||
|
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||||
|
('Referer', 'http://%s/' % baseurl), ('Accept-encoding', 'gzip'), ]
|
||||||
|
|
||||||
|
opener = urllib2.build_opener()
|
||||||
|
opener.addheaders = headers
|
||||||
|
result = opener.open(torrentUrl)
|
||||||
|
if result.info().get('Content-Encoding') == 'gzip':
|
||||||
|
buf = StringIO(result.read())
|
||||||
|
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
|
||||||
|
content = decomp.decompress(buf.getvalue())
|
||||||
|
else:
|
||||||
|
content = result.read()
|
||||||
|
return content
|
||||||
|
|
||||||
def md5(self, string):
|
def md5(self, string):
|
||||||
hasher = hashlib.md5()
|
hasher = hashlib.md5()
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -95,21 +95,12 @@ class SkorbaLoader:
|
||||||
xbmcvfs.mkdirs(self.torrentFilesPath)
|
xbmcvfs.mkdirs(self.torrentFilesPath)
|
||||||
torrentFile = localize_path(os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent'))
|
torrentFile = localize_path(os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent'))
|
||||||
try:
|
try:
|
||||||
if not re.match("^http\:.+$", torrentUrl):
|
if not re.match("^[htps]+?://.+$|^://.+$", torrentUrl):
|
||||||
contentFile = xbmcvfs.File(torrentUrl, "rb")
|
log('xbmcvfs.File for %s' % torrentUrl)
|
||||||
content = contentFile.read()
|
content = xbmcvfs.File(torrentUrl, "rb").read()
|
||||||
contentFile.close()
|
|
||||||
else:
|
else:
|
||||||
request = urllib2.Request(torrentUrl)
|
log('request for %s' % torrentUrl)
|
||||||
request.add_header('Referer', torrentUrl)
|
content = self.makeRequest(torrentUrl)
|
||||||
request.add_header('Accept-encoding', 'gzip')
|
|
||||||
result = urllib2.urlopen(request)
|
|
||||||
if result.info().get('Content-Encoding') == 'gzip':
|
|
||||||
buf = StringIO(result.read())
|
|
||||||
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
|
|
||||||
content = decomp.decompress(buf.getvalue())
|
|
||||||
else:
|
|
||||||
content = result.read()
|
|
||||||
|
|
||||||
localFile = xbmcvfs.File(torrentFile, "w+b")
|
localFile = xbmcvfs.File(torrentFile, "w+b")
|
||||||
localFile.write(content)
|
localFile.write(content)
|
||||||
|
@ -144,7 +135,30 @@ class SkorbaLoader:
|
||||||
self.torrentFileInfo = self.lt.torrent_info(e)
|
self.torrentFileInfo = self.lt.torrent_info(e)
|
||||||
self.torrentFile = torrentFile
|
self.torrentFile = torrentFile
|
||||||
return self.torrentFile
|
return self.torrentFile
|
||||||
|
|
||||||
|
def makeRequest(self, torrentUrl):
|
||||||
|
torrentUrl = re.sub('^://', 'http://', torrentUrl)
|
||||||
|
x = re.search("://(.+?)/|://(.+?)$", torrentUrl)
|
||||||
|
if x:
|
||||||
|
baseurl = x.group(1) if x.group(1) else x.group(2)
|
||||||
|
else:
|
||||||
|
baseurl =''
|
||||||
|
|
||||||
|
headers = [('User-Agent',
|
||||||
|
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||||
|
('Referer', 'http://%s/' % baseurl), ('Accept-encoding', 'gzip'), ]
|
||||||
|
|
||||||
|
opener = urllib2.build_opener()
|
||||||
|
opener.addheaders = headers
|
||||||
|
result = opener.open(torrentUrl)
|
||||||
|
if result.info().get('Content-Encoding') == 'gzip':
|
||||||
|
buf = StringIO(result.read())
|
||||||
|
decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
|
||||||
|
content = decomp.decompress(buf.getvalue())
|
||||||
|
else:
|
||||||
|
content = result.read()
|
||||||
|
return content
|
||||||
|
|
||||||
def getMagnetInfo(self):
|
def getMagnetInfo(self):
|
||||||
magnetSettings = {
|
magnetSettings = {
|
||||||
'url': self.magnetLink,
|
'url': self.magnetLink,
|
||||||
|
|
Loading…
Reference in New Issue