major search update, external serachers
This commit is contained in:
1 parent
502c33fe90
commit
40955a402f
13 files changed
+244
-305
No files matched your search
@@ -57,5 +57,10 @@
|
||||
<string id="30412">Close</string>
|
||||
<string id="30413">Open Settings</string>
|
||||
<string id="30414">Torrent Client Browser</string>
|
||||
<string id="30415">Install Trackers</string>
|
||||
<string id="30416">Trackers Settings</string>
|
||||
<string id="30417">Clear Storage</string>
|
||||
<string id="30418">Choose searcher</string>
|
||||
<string id="30419">You don't have external searcher. Please install it first.</string>
|
||||
|
||||
</strings>
|
||||
@@ -57,6 +57,9 @@
|
||||
<string id="30412">Закрыть</string>
|
||||
<string id="30413">Открыть Настройки</string>
|
||||
<string id="30414">Браузер Торрент-клиента</string>
|
||||
|
||||
<string id="30146">Статус Плагина</string>
|
||||
<string id="30415">Установить Трекеры</string>
|
||||
<string id="30416">Настройки Трекеров</string>
|
||||
<string id="30417">Очистить хранилище</string>
|
||||
<string id="30418">Выберите трекер</string>
|
||||
<string id="30419">У вас нет внешних серчеров. Пожалуйста, сначало установите их.</string>
|
||||
</strings>
|
||||
@@ -58,4 +58,9 @@
|
||||
<string id="30413">Відкрити налаштування</string>
|
||||
<string id="30414">Браузер торрент-клієнта</string>
|
||||
<string id="30146">Статус плагіна</string>
|
||||
<string id="30415">Установить Трекеры</string>
|
||||
<string id="30416">Настройки Трекеров</string>
|
||||
<string id="30417">Очистити сховище</string>
|
||||
<string id="30418">Оберіть трекер</string>
|
||||
<string id="30419">У вас нет внешних серчеров. Пожалуйста, сначало установите их.</string>
|
||||
</strings>
|
||||
@@ -1,90 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Torrenter plugin for XBMC
|
||||
Copyright (C) 2012 Vadim Skorba
|
||||
vadim.skorba@gmail.com
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import urllib
|
||||
import re
|
||||
import sys
|
||||
|
||||
import SearcherABC
|
||||
|
||||
|
||||
class OldPirateBay(SearcherABC.SearcherABC):
|
||||
'''
|
||||
Weight of source with this searcher provided.
|
||||
Will be multiplied on default weight.
|
||||
Default weight is seeds number
|
||||
'''
|
||||
sourceWeight = 1
|
||||
|
||||
'''
|
||||
Relative (from root directory of plugin) path to image
|
||||
will shown as source image at result listing
|
||||
'''
|
||||
searchIcon = '/resources/searchers/icons/OldPirateBay3.png'
|
||||
|
||||
'''
|
||||
Flag indicates is this source - magnet links source or not.
|
||||
Used for filtration of sources in case of old library (setting selected).
|
||||
Old libraries won't to convert magnet as torrent file to the storage
|
||||
'''
|
||||
|
||||
@property
|
||||
def isMagnetLinkSource(self):
|
||||
return False
|
||||
|
||||
'''
|
||||
Main method should be implemented for search process.
|
||||
Receives keyword and have to return dictionary of proper tuples:
|
||||
filesList.append((
|
||||
int(weight),# Calculated global weight of sources
|
||||
int(seeds),# Seeds count
|
||||
str(title),# Title will be shown
|
||||
str(link),# Link to the torrent/magnet
|
||||
str(image),# Path/URL to image shown at the list
|
||||
))
|
||||
'''
|
||||
|
||||
def search(self, keyword):
|
||||
self.timeout(10)
|
||||
filesList = []
|
||||
url = "http://oldpiratebay.org/search.php?q=%s" % (urllib.quote_plus(keyword))
|
||||
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://opensharing.org/'), ('Accept-encoding', 'gzip'), ]
|
||||
response = self.makeRequest(url, headers=headers)
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
dat = re.compile(
|
||||
r'''<a href="/torrent/.+?">(.+?)</a>.+?<a class=".+?" href="(.+?)" title="TORRENT LINK">.+?<td .+?>(.+?)</td><td class=".+?">(.+?)</td><td class=".+?">(.+?)</td><td .+?>(.+?)</td></tr>''',
|
||||
re.DOTALL).findall(response)
|
||||
for (title, link, age, size, seeds, leechers) in dat:
|
||||
torrentTitle = title #"%s [S\L: %s\%s]" % (title, seeds, leechers)
|
||||
size = self.unescape(self.stripHtml(size))
|
||||
image = sys.modules["__main__"].__root__ + self.searchIcon
|
||||
link = self.unescape(link)
|
||||
filesList.append((
|
||||
int(int(self.sourceWeight) * int(seeds)),
|
||||
int(seeds), int(leechers), size,
|
||||
self.unescape(self.stripHtml(torrentTitle)),
|
||||
self.__class__.__name__ + '::' + link,
|
||||
image,
|
||||
))
|
||||
return filesList
|
||||
@@ -65,10 +65,10 @@ class RuTorOrg(SearcherABC.SearcherABC):
|
||||
filesList = []
|
||||
self.timeout(5)
|
||||
#print 'strating Rutor'
|
||||
url = "http://zerkalo-rutor.org/search/0/0/100/2/%s" % urllib.quote_plus(keyword)
|
||||
url = "http://anti-tor.org/search/0/0/100/2/%s" % urllib.quote_plus(keyword)
|
||||
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://zerkalo-rutor.org'), ('Accept-encoding', 'gzip'),
|
||||
('Referer', 'http://anti-tor.org'), ('Accept-encoding', 'gzip'),
|
||||
('Cookie', str(sys.modules["__main__"].__settings__.getSetting("rutor-auth")))]
|
||||
response = self.makeRequest(url, headers=headers)
|
||||
|
||||
@@ -83,7 +83,7 @@ class RuTorOrg(SearcherABC.SearcherABC):
|
||||
sys.modules["__main__"].__settings__.setSetting("rutor-auth", cookie)
|
||||
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://zerkalo-rutor.org'), ('Accept-encoding', 'gzip'),
|
||||
('Referer', 'http://anti-tor.org'), ('Accept-encoding', 'gzip'),
|
||||
('Cookie', str(sys.modules["__main__"].__settings__.getSetting("rutor-auth")))]
|
||||
response = self.makeRequest(url, headers=headers)
|
||||
|
||||
@@ -97,7 +97,7 @@ class RuTorOrg(SearcherABC.SearcherABC):
|
||||
for (link, title, size, seeds, leechers) in dat:
|
||||
torrentTitle = title.strip() #"%s [S\L: %s\%s]" % (title, seeds, leechers)
|
||||
size = size.replace(' ', ' ')
|
||||
if link[0]=='/': link='http://zerkalo-rutor.org'+link
|
||||
if link[0]=='/': link='http://anti-tor.org'+link
|
||||
image = sys.modules["__main__"].__root__ + self.searchIcon
|
||||
filesList.append((
|
||||
int(int(self.sourceWeight) * int(seeds)),
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Torrenter plugin for XBMC
|
||||
Copyright (C) 2012 Vadim Skorba
|
||||
vadim.skorba@gmail.com
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import urllib
|
||||
import re
|
||||
import sys
|
||||
|
||||
import SearcherABC
|
||||
|
||||
|
||||
class ThePirateBaySe(SearcherABC.SearcherABC):
|
||||
'''
|
||||
Weight of source with this searcher provided.
|
||||
Will be multiplied on default weight.
|
||||
Default weight is seeds number
|
||||
'''
|
||||
sourceWeight = 1
|
||||
|
||||
'''
|
||||
Relative (from root directory of plugin) path to image
|
||||
will shown as source image at result listing
|
||||
'''
|
||||
searchIcon = '/resources/searchers/icons/thepiratebay.se.png'
|
||||
|
||||
'''
|
||||
Flag indicates is this source - magnet links source or not.
|
||||
Used for filtration of sources in case of old library (setting selected).
|
||||
Old libraries won't to convert magnet as torrent file to the storage
|
||||
'''
|
||||
|
||||
@property
|
||||
def isMagnetLinkSource(self):
|
||||
return True
|
||||
|
||||
'''
|
||||
Main method should be implemented for search process.
|
||||
Receives keyword and have to return dictionary of proper tuples:
|
||||
filesList.append((
|
||||
int(weight),# Calculated global weight of sources
|
||||
int(seeds),# Seeds count
|
||||
str(title),# Title will be shown
|
||||
str(link),# Link to the torrent/magnet
|
||||
str(image),# Path/URL to image shown at the list
|
||||
))
|
||||
'''
|
||||
|
||||
def search(self, keyword):
|
||||
filesList = []
|
||||
url = "http://thepiratebay.se/search/%s/0/99/200" % (urllib.quote_plus(keyword))
|
||||
|
||||
response = self.makeRequest(url)
|
||||
|
||||
if None != response and 0 < len(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)
|
||||
size = size.replace(' ', ' ')
|
||||
image = sys.modules["__main__"].__root__ + self.searchIcon
|
||||
if not re.match('^https?\://.+', link) and not re.match('^magnet\:.+', link):
|
||||
link = re.search('^(https?\://.+?)/.+', url).group(1) + link
|
||||
filesList.append((
|
||||
int(int(self.sourceWeight) * int(seeds)),
|
||||
int(seeds), int(leechers), size,
|
||||
self.unescape(self.stripHtml(torrentTitle)),
|
||||
self.__class__.__name__ + '::' + link,
|
||||
image,
|
||||
))
|
||||
return filesList
|
||||
Reference in new issue
Block a user