platform fix

This commit is contained in:
DiMartinoXBMC committed 2015-06-23 23:00:27 +03:00
1 parent 30df420b4f
commit ca92203b75
33 files changed
+1835 -1356

No files matched your search

+9 -12
View File
@@ -21,9 +21,6 @@
import urllib
import re
import sys
import tempfile
import os
import time
import SearcherABC
@@ -66,7 +63,7 @@ class RuTrackerOrg(SearcherABC.SearcherABC):
def search(self, keyword):
filesList = []
url='http://rutracker.org/forum/tracker.php?nm=' + urllib.quote_plus(keyword)
url = 'http://rutracker.org/forum/tracker.php?nm=' + urllib.quote_plus(keyword)
data = {'prev_my': '0',
'prev_new': '0',
@@ -79,11 +76,11 @@ class RuTrackerOrg(SearcherABC.SearcherABC):
response = self.makeRequest(url, data=data)
if None != response and 0 < len(response):
response = response.decode('cp1251').encode('utf8')
#print response
# print response
if not self.check_login(response):
response = self.makeRequest(url, data=data)
response = response.decode('cp1251').encode('utf8')
#print response
# print response
forums = [7, 187, 2090, 2221, 2091, 2092, 2093, 934, 505, 212, 2459, 1235, 185, 22, 941, 1666, 124, 1543,
376, 709, 1577, 511, 656, 93, 905, 1576, 101, 100, 103, 572, 1670, 2198, 2199, 313, 2201, 312,
2339, 314, 352, 549, 1213, 2109, 514, 2097, 4, 930, 2365, 1900, 521, 2258, 208, 539, 209, 484,
@@ -128,19 +125,19 @@ class RuTrackerOrg(SearcherABC.SearcherABC):
def getTorrentFile(self, url):
self.load_cookie()
cookie=None
cookie = None
for cookie in self.cookieJar:
if cookie.name=='bb_data' and cookie.domain=='.rutracker.org':
cookie = 'bb_data=' + cookie.value + '; bb_dl=' + re.search('(\d+)$',url).group(1)
if cookie.name == 'bb_data' and cookie.domain == '.rutracker.org':
cookie = 'bb_data=' + cookie.value + '; bb_dl=' + re.search('(\d+)$', url).group(1)
break
if not cookie:
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$',url).group(1)
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$', url).group(1)
referer = 'http://rutracker.org/forum/viewtopic.php?t=' + re.search('(\d+)$', url).group(1)
headers=[('Cookie', cookie), ('Referer', referer)]
headers = [('Cookie', cookie), ('Referer', referer)]
content = self.makeRequest(url, headers=headers)
if not self.check_login(content):
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$',url).group(1)
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$', url).group(1)
content = self.makeRequest(url, headers=[('Cookie', cookie), ('Referer', referer)])
return self.saveTorrentFile(url, content)
+22 -23
View File
@@ -19,9 +19,7 @@
'''
import re
import os
import urllib
import tempfile
import sys
import SearcherABC
@@ -63,25 +61,26 @@ class T411FR(SearcherABC.SearcherABC):
))'''
headers = {('Origin', 'http://t411.io'),
('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://t411.io/'),('X-NewRelic-ID','x='),
('X-Requested-With','XMLHttpRequest'),}
('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://t411.io/'), ('X-NewRelic-ID', 'x='),
('X-Requested-With', 'XMLHttpRequest'), }
def search(self, keyword):
filesList = []
url='http://www.t411.io/torrents/search/?search=%s' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
url+='&order=seeders&type=desc'
url = 'http://www.t411.io/torrents/search/?search=%s' % urllib.quote_plus(
keyword.decode('utf-8').encode('cp1251'))
url += '&order=seeders&type=desc'
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
#self.cookieJar.save(ignore_discard=True)
#self.check_login(response)
#print response
# self.cookieJar.save(ignore_discard=True)
# self.check_login(response)
# print response
regex = '''<a href="//.+?" title="(.+?)">.+?<span class="up">.+?<a href="/torrents/nfo/\?id=(\d+)" class="ajax nfo"></a>.+?</td>.+?<td align="center">.+?</td>.+?<td align="center">.+?</td>.+?<td align="center">(.+?)</td>.+?<td align="center" class="up">(\d+)</td>.+?<td align="center" class="down">(\d+)</td>'''
for (title, link, size, seeds, leechers) in re.compile(regex, re.DOTALL).findall(response):
title=self.clear_title(title)
title = self.clear_title(title)
image = sys.modules["__main__"].__root__ + self.searchIcon
link = 'http://www.t411.io/torrents/download/?id='+link
link = 'http://www.t411.io/torrents/download/?id=' + link
filesList.append((
int(int(self.sourceWeight) * int(seeds)),
int(seeds), int(leechers), size,
@@ -92,11 +91,11 @@ class T411FR(SearcherABC.SearcherABC):
return filesList
def clear_title(self, s):
return self.stripHtml(self.unescape(s)).replace(' ',' ').replace(' ',' ').strip()
return self.stripHtml(self.unescape(s)).replace(' ', ' ').replace(' ', ' ').strip()
def check_login(self, response=None):
if None != response and 0 < len(response):
#print response
# print response
if re.compile('<input class="userInput"').search(response) or \
re.compile('start cache').search(response):
print 'T411FR Not logged!'
@@ -106,24 +105,24 @@ class T411FR(SearcherABC.SearcherABC):
def getTorrentFile(self, url):
content = self.makeRequest(url, headers=self.headers)
#print content
# print content
if not self.check_login(content):
content = self.makeRequest(url, headers=self.headers)
#return url
# return url
return self.saveTorrentFile(url, content)
def login(self):
data = {
'password': 'toraddon20',
'login': 'zombitorrent',
'remember':'1'
'remember': '1'
}
x=self.makeRequest(
'http://www.t411.io/users/auth/',data=data, headers=self.headers)
if re.search('{"status":"OK"',x):
x = self.makeRequest(
'http://www.t411.io/users/auth/', data=data, headers=self.headers)
if re.search('{"status":"OK"', x):
print 'LOGGED T411FR'
self.cookieJar.save(ignore_discard=True)
for cookie in self.cookieJar:
if cookie.name == 'authKey' and cookie.domain=='.t411.io':
if cookie.name == 'authKey' and cookie.domain == '.t411.io':
return 'authKey=' + cookie.value
return False
return False
+15 -17
View File
@@ -19,9 +19,7 @@
'''
import re
import os
import urllib
import tempfile
import sys
import SearcherABC
@@ -64,8 +62,8 @@ class TFileME(SearcherABC.SearcherABC):
def search(self, keyword):
filesList = []
url='http://tfile.me/forum/ssearch.php?q=%s' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
url+='&c=2&f=4&f=1488&f=1379&f=1225&f=1331&f=1248&f=1197&f=1026&f=293&f=1227&f=577&f=298&f=297&f=290&f=299&f=230&f=303&f=292&f=1240&f=304&f=296&f=300&f=1332&f=1324&f=691&f=301&f=294&f=1241&f=498&f=367&f=574&f=1226&f=295&f=189&f=1525&f=1224&f=1388&f=1387&f=1276&f=1889&f=1917&f=1907&f=1908&f=1909&f=1910&f=1911&f=1890&f=1891&f=1892&f=1893&f=1912&f=1899&f=1894&f=1895&f=1903&f=1896&f=1897&f=1898&f=1900&f=1902&f=1901&f=1904&f=1905&f=1906&f=1913&f=15&f=1918&f=1374&f=1946&f=1579&f=1947&f=1242&f=1508&f=1165&f=1166&f=1245&f=1158&f=532&f=1167&f=1159&f=1244&f=1160&f=1173&f=1238&f=1678&f=1161&f=1320&f=1162&f=1246&f=496&f=1164&f=1163&f=1172&f=1243&f=1386&f=1312&f=1536&f=1919&f=1577&f=1989&f=1578&f=1554&f=1537&f=1538&f=1539&f=1540&f=1541&f=1542&f=1543&f=1555&f=1680&f=1544&f=1556&f=1545&f=1546&f=1547&f=1848&f=1548&f=1550&f=1620&f=1920&f=193&f=1968&f=1237&f=1420&f=1036&f=449&f=448&f=447&f=537&f=1170&f=37&f=1921&f=1323&f=1252&f=1685&f=697&f=172&f=311&f=183&f=130&f=1024&f=139&f=1023&f=179&f=392&f=308&f=342&f=1612&f=1015&f=96&f=353&f=997&f=285&f=154&f=1613&f=975&f=168&f=1849&f=1020&f=265&f=123&f=1614&f=1615&f=117&f=155&f=1611&f=1616&f=1617&f=152&f=105&f=312&f=127&f=1030&f=150&f=328&f=305&f=149&f=136&f=134&f=158&f=169&f=1421&f=768&f=767&f=309&f=377&f=1017&f=1590&f=1923&f=1591&f=1966&f=1592&f=1607&f=1593&f=1594&f=1595&f=1596&f=1597&f=1598&f=1599&f=1600&f=1844&f=1601&f=1602&f=1603&f=1604&f=1605&f=1681&f=17&f=1924&f=1415&f=1964&f=1416&f=1304&f=1146&f=1147&f=1156&f=1534&f=1142&f=29&f=85&f=1514&f=1148&f=1515&f=384&f=216&f=1149&f=232&f=1535&f=506&f=1517&f=1516&f=1000&f=1518&f=237&f=243&f=1150&f=244&f=239&f=197&f=236&f=1151&f=235&f=1152&f=234&f=1153&f=1018&f=1143&f=1563&f=1925&f=1564&f=1565&f=1566&f=1567&f=1568&f=1569&f=1570&f=1571&f=1572&f=1574&f=1575&f=1576&f=1926&f=175&f=1881&f=1256&f=1145&f=1140&f=1253&f=1157&f=727&f=1551&f=567&f=1254&f=219&f=568&f=974&f=495&f=743&f=494&f=401&f=731&f=499&f=500&f=538&f=206&f=1040&f=446&f=1005&f=210&f=203&f=207&f=204&f=1255&f=202&f=1141&f=16&f=1927&f=1380&f=1425&f=1438&f=1333&f=187&f=1062&f=1310&f=1059&f=1033&f=1509&f=1193&f=1195&f=1064&f=1063&f=1028&f=1058&f=1019&f=490&f=1397&f=1065&f=1419&f=1194&f=1070&f=274&f=1383&f=1334&f=1067&f=1068&f=1066&f=1069&f=1060&f=1282&f=19&f=1915&f=1872&f=1922&f=1284&f=1294&f=1301&f=1288&f=1291&f=1309&f=39&f=1285&f=1290&f=1306&f=1295&f=1300&f=1302&f=1287&f=1307&f=1292&f=1299&f=1297&f=1293&f=1888&f=1286&f=1298&f=1296&f=1519&f=1303&f=1527&g=&act=&y=&ql=&a=&d=&o=&size_min=0&size_max=0'
url = 'http://tfile.me/forum/ssearch.php?q=%s' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
url += '&c=2&f=4&f=1488&f=1379&f=1225&f=1331&f=1248&f=1197&f=1026&f=293&f=1227&f=577&f=298&f=297&f=290&f=299&f=230&f=303&f=292&f=1240&f=304&f=296&f=300&f=1332&f=1324&f=691&f=301&f=294&f=1241&f=498&f=367&f=574&f=1226&f=295&f=189&f=1525&f=1224&f=1388&f=1387&f=1276&f=1889&f=1917&f=1907&f=1908&f=1909&f=1910&f=1911&f=1890&f=1891&f=1892&f=1893&f=1912&f=1899&f=1894&f=1895&f=1903&f=1896&f=1897&f=1898&f=1900&f=1902&f=1901&f=1904&f=1905&f=1906&f=1913&f=15&f=1918&f=1374&f=1946&f=1579&f=1947&f=1242&f=1508&f=1165&f=1166&f=1245&f=1158&f=532&f=1167&f=1159&f=1244&f=1160&f=1173&f=1238&f=1678&f=1161&f=1320&f=1162&f=1246&f=496&f=1164&f=1163&f=1172&f=1243&f=1386&f=1312&f=1536&f=1919&f=1577&f=1989&f=1578&f=1554&f=1537&f=1538&f=1539&f=1540&f=1541&f=1542&f=1543&f=1555&f=1680&f=1544&f=1556&f=1545&f=1546&f=1547&f=1848&f=1548&f=1550&f=1620&f=1920&f=193&f=1968&f=1237&f=1420&f=1036&f=449&f=448&f=447&f=537&f=1170&f=37&f=1921&f=1323&f=1252&f=1685&f=697&f=172&f=311&f=183&f=130&f=1024&f=139&f=1023&f=179&f=392&f=308&f=342&f=1612&f=1015&f=96&f=353&f=997&f=285&f=154&f=1613&f=975&f=168&f=1849&f=1020&f=265&f=123&f=1614&f=1615&f=117&f=155&f=1611&f=1616&f=1617&f=152&f=105&f=312&f=127&f=1030&f=150&f=328&f=305&f=149&f=136&f=134&f=158&f=169&f=1421&f=768&f=767&f=309&f=377&f=1017&f=1590&f=1923&f=1591&f=1966&f=1592&f=1607&f=1593&f=1594&f=1595&f=1596&f=1597&f=1598&f=1599&f=1600&f=1844&f=1601&f=1602&f=1603&f=1604&f=1605&f=1681&f=17&f=1924&f=1415&f=1964&f=1416&f=1304&f=1146&f=1147&f=1156&f=1534&f=1142&f=29&f=85&f=1514&f=1148&f=1515&f=384&f=216&f=1149&f=232&f=1535&f=506&f=1517&f=1516&f=1000&f=1518&f=237&f=243&f=1150&f=244&f=239&f=197&f=236&f=1151&f=235&f=1152&f=234&f=1153&f=1018&f=1143&f=1563&f=1925&f=1564&f=1565&f=1566&f=1567&f=1568&f=1569&f=1570&f=1571&f=1572&f=1574&f=1575&f=1576&f=1926&f=175&f=1881&f=1256&f=1145&f=1140&f=1253&f=1157&f=727&f=1551&f=567&f=1254&f=219&f=568&f=974&f=495&f=743&f=494&f=401&f=731&f=499&f=500&f=538&f=206&f=1040&f=446&f=1005&f=210&f=203&f=207&f=204&f=1255&f=202&f=1141&f=16&f=1927&f=1380&f=1425&f=1438&f=1333&f=187&f=1062&f=1310&f=1059&f=1033&f=1509&f=1193&f=1195&f=1064&f=1063&f=1028&f=1058&f=1019&f=490&f=1397&f=1065&f=1419&f=1194&f=1070&f=274&f=1383&f=1334&f=1067&f=1068&f=1066&f=1069&f=1060&f=1282&f=19&f=1915&f=1872&f=1922&f=1284&f=1294&f=1301&f=1288&f=1291&f=1309&f=39&f=1285&f=1290&f=1306&f=1295&f=1300&f=1302&f=1287&f=1307&f=1292&f=1299&f=1297&f=1293&f=1888&f=1286&f=1298&f=1296&f=1519&f=1303&f=1527&g=&act=&y=&ql=&a=&d=&o=&size_min=0&size_max=0'
headers = {('Origin', 'http://tfile.me'),
('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'),
@@ -75,15 +73,15 @@ class TFileME(SearcherABC.SearcherABC):
if None != response and 0 < len(response):
response = response.decode('cp1251').encode('utf-8')
self.cookieJar.save(ignore_discard=True)
#self.check_login(response)
#print response
#bad_forums = [2,1,23,32,40,41]
# self.check_login(response)
# print response
# bad_forums = [2,1,23,32,40,41]
regex = '''<a href="/forum/viewforum\.php\?f=(\d+)">.+?<a href="/forum/viewtopic\.php\?t=.+?">(.+?)</a>.+?<a href="/forum/download\.php\?id=(\d+)">(.+?)</a>.+?class="sd">(\d+)</b>.+?class="lc">(\d+)'''
for (forum, title, link, size, seeds, leechers) in re.compile(regex, re.DOTALL).findall(response):
#if int(forum) not in bad_forums:
title=self.clear_title(title)
# if int(forum) not in bad_forums:
title = self.clear_title(title)
image = sys.modules["__main__"].__root__ + self.searchIcon
link = 'http://tfile.me/forum/download.php?id='+link
link = 'http://tfile.me/forum/download.php?id=' + link
filesList.append((
int(int(self.sourceWeight) * int(seeds)),
int(seeds), int(leechers), size,
@@ -94,11 +92,11 @@ class TFileME(SearcherABC.SearcherABC):
return filesList
def clear_title(self, s):
return self.stripHtml(self.unescape(s)).replace(' ',' ').replace(' ',' ').strip()
return self.stripHtml(self.unescape(s)).replace(' ', ' ').replace(' ', ' ').strip()
def check_login(self, response=None):
if None != response and 0 < len(response):
#print response
# print response
if re.compile('<input class="text" type="text" name="username"').search(response):
print 'TFileME Not logged!'
self.login()
@@ -109,21 +107,21 @@ class TFileME(SearcherABC.SearcherABC):
self.timeout(5)
self.check_login(self.makeRequest('http://tfile.me/'))
content = self.makeRequest(url)
#return url
# return url
return self.saveTorrentFile(url, content)
def login(self):
data = {
'password': 'torrenter',
'username': 'torrenterpl',
'login':'Вход'
'login': 'Вход'
}
x=self.makeRequest(
x = self.makeRequest(
'http://tfile.me/login/',
data
)
self.cookieJar.save(ignore_discard=True)
for cookie in self.cookieJar:
if cookie.name == 'phpbb2mysql_data' and cookie.domain=='.tfile.me':
if cookie.name == 'phpbb2mysql_data' and cookie.domain == '.tfile.me':
return 'phpbb2mysql_data=' + cookie.value
return False
return False
+3 -4
View File
@@ -21,7 +21,6 @@
import urllib
import re
import sys
import urllib2
import SearcherABC
@@ -69,12 +68,12 @@ class ThePirateBaySe(SearcherABC.SearcherABC):
response = self.makeRequest(url)
if None != response and 0 < len(response):
#print response
# print response
dat = re.compile(
r'<div class="detName">.+?">(.+?)</a>.+?<a href="(.+?)".+?<font class="detDesc">Uploaded .+?, Size (.+?), .+?</font>.+?<td align="right">(\d+?)</td>.+?<td align="right">(\d+?)</td>',
re.DOTALL).findall(response)
for (title, link, size, seeds, leechers) in dat:
torrentTitle = title #"%s [S\L: %s\%s]" % (title, seeds, leechers)
torrentTitle = title # "%s [S\L: %s\%s]" % (title, seeds, leechers)
size = size.replace('&nbsp;', ' ')
image = sys.modules["__main__"].__root__ + self.searchIcon
if not re.match('^https?\://.+', link) and not re.match('^magnet\:.+', link):
@@ -86,4 +85,4 @@ class ThePirateBaySe(SearcherABC.SearcherABC):
self.__class__.__name__ + '::' + link,
image,
))
return filesList
return filesList
+12 -13
View File
@@ -19,9 +19,7 @@
'''
import re
import os
import urllib
import tempfile
import sys
import SearcherABC
@@ -64,7 +62,8 @@ class KinoZalTV(SearcherABC.SearcherABC):
def search(self, keyword):
filesList = []
url='http://kinozal.tv/browse.php?s=%s&g=0&c=0&v=0&d=0&w=0&t=1&f=0' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
url = 'http://kinozal.tv/browse.php?s=%s&g=0&c=0&v=0&d=0&w=0&t=1&f=0' % urllib.quote_plus(
keyword.decode('utf-8').encode('cp1251'))
headers = {('Origin', 'http://kinozal.tv'),
('User-Agent',
@@ -74,8 +73,8 @@ class KinoZalTV(SearcherABC.SearcherABC):
response = self.makeRequest(url, headers=headers)
if None != response and 0 < len(response):
response = response.decode('cp1251').encode('utf-8')
#print response
bad_forums = [2,1,23,32,40,41]
# print response
bad_forums = [2, 1, 23, 32, 40, 41]
regex = '''onclick="cat\((\d+)\);".+?<a href="/details\.php\?id=(\d+)".+?>(.+?)</a>.+?<td class='s'>(.+?)</td>.+?class='sl_s'>(\d+)</td>.+?class='sl_p'>(\d+)</td>'''
for (forum, topic, title, size, seeds, leechers) in re.compile(regex, re.DOTALL).findall(response):
if int(forum) not in bad_forums:
@@ -102,10 +101,10 @@ class KinoZalTV(SearcherABC.SearcherABC):
self.timeout(5)
content = self.makeRequest(url)
#print content
# print content
if not self.check_login(content):
content = self.makeRequest(url)
#print content
# print content
return self.saveTorrentFile(url, content)
@@ -113,7 +112,7 @@ class KinoZalTV(SearcherABC.SearcherABC):
data = {
'password': 'torrenter',
'username': 'torrenterpl',
'returnto:':''
'returnto:': ''
}
self.makeRequest(
'http://kinozal.tv/takelogin.php',
@@ -121,11 +120,11 @@ class KinoZalTV(SearcherABC.SearcherABC):
)
self.cookieJar.save(ignore_discard=True)
for cookie in self.cookieJar:
uid,passed=None,None
uid, passed = None, None
if cookie.name == 'uid':
uid=cookie.value
uid = cookie.value
if cookie.name == 'pass':
passed=cookie.value
passed = cookie.value
if uid and passed:
return 'uid=' + uid+'; pass='+ passed
return False
return 'uid=' + uid + '; pass=' + passed
return False