why?
This commit is contained in:
DiMartinoX committed 2015-01-09 14:11:21 +03:00
commit 6fef9834fe
396 files changed
+49459

No files matched your search

+191
View File
@@ -0,0 +1,191 @@
# -*- 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 re
import Content
from BeautifulSoup import BeautifulSoup
def make_category_dict():
category_dict = {
'movies': ('Forieng Movies', '/films/fl_foreign_hight/?'),
'rus_movies': ('Russian Movies', '/films/fl_our_hight/?'),
'tvshows': ('TV Shows', '/serials/fl_hight/?'),
'cartoons': ('Cartoons', '/cartoons/fl_hight/?'),
'anime': ('Anime', '/cartoons/cartoon_genre/anime/?'),
'hot': ('Hot & New', '/films/fl_hight/?'),
'top': ('Top 250 Movies', '/films/fl_hight/?sort=popularity&'),
'genre': {'genre': 'by Genre',
'action': ('Action', '/films/film_genre/bojevik/?'),
'adventure': ('Adventure', '/films/film_genre/priklucheniya/?'),
'biography': ('Biography', '/films/film_genre/biografiya/?'),
'comedy': ('Comedy', '/films/film_genre/komediya/?'),
'crime': ('Crime', '/films/film_genre/detektiv/?'),
'documentary': ('Documentary', '/films/film_genre/dokumentalnyj/?'),
'drama': ('Drama', '/films/film_genre/drama/?'),
'erotika': ('Adult', '/films/film_genre/erotika/?'),
'family': ('Family', '/films/film_genre/semejnyj/?'),
'fantasy': ('Fantasy', '/films/film_genre/fentezi/?'),
'film_noir': ('Film-Noir', '/films/film_genre/nuar/?'),
'history': ('History', '/films/film_genre/istoriya/?'),
'horror': ('Horror', '/films/film_genre/uzhasy/?'),
'kids': ('For Kids', '/films/film_genre/detskij/?'),
'musical': ('Musical', '/films/film_genre/muzikl/?'),
'mystery': ('Mystery', '/films/film_genre/mistika/?'),
'romance': ('Romance', '/films/film_genre/melodrama/?'),
'sci_fi': ('Sci-Fi', '/films/film_genre/fantastika/?'),
'short': ('Short', '/films/film_genre/korotkometrazhka/?'),
'thriller': ('Thriller', '/films/film_genre/triller/?'),
'war': ('War', '/films/film_genre/vojennyj/?'),
'western': ('Western', '/films/film_genre/vestern/?'),
}
}
for category in category_dict.keys():
if isinstance(category_dict.get(category), dict):
for subcategory in category_dict.get(category).keys():
if subcategory != category:
x = category_dict[category][subcategory]
category_dict[category][subcategory] = (
x[0], x[1] + 'view=list', {'page': x[1] + 'view=list&page=%d', 'increase': 1, 'second_page': 1})
if not isinstance(category_dict.get(category), dict):
x = category_dict[category]
category_dict[category] = (
x[0], x[1] + 'view=list', {'page': x[1] + 'view=list&page=%d', 'increase': 1, 'second_page': 1})
category_dict['year'] = {'year': 'by Year', }
for y in range(2015, 1970, -1):
category_dict['year'][str(y)] = (str(y), '/films/year/%s/' % str(y),
{'page': '/films/year/%s/' % str(y) + '?view=list&page=%d', 'increase': 1,
'second_page': 1})
return category_dict
class CXZ(Content.Content):
category_dict = make_category_dict()
regex_list = []
baseurl = "http://cxz.to"
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', baseurl), ('Accept-Encoding', 'gzip'), ('Accept-Language', 'ru,en;q=0.8')]
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 2
def isLabel(self):
return False
def isPages(self):
return True
def isSearchOption(self):
return True
def isScrappable(self):
return True
def get_contentList(self, category, subcategory=None, page=None):
contentList = []
url = self.get_url(category, subcategory, page, self.baseurl)
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
#print response
if category:
contentList = self.mode(response)
#print str(contentList)
return contentList
def mode(self, response):
contentList = []
Soup = BeautifulSoup(response)
result = Soup.findAll('div', {'class': 'b-poster-tile '})
num = 0
for tr in result:
#main
info = {}
year = 0
num = num + 1
title = tr.find('span', 'b-poster-tile__title-full').text.strip()
originaltitle = None
year = re.compile('(\d\d\d\d)').findall(tr.find('span', 'b-poster-tile__title-info-items').text)[0]
link = tr.find('a', 'b-poster-tile__link').get('href')
for i in ['/serials/', '/cartoonserials/', '/tvshow/']:
if i in link:
info['tvshowtitle'] = title
break
img = tr.find('img').get('src')
img = img if img else ''
#info
contentList.append((
int(int(self.sourceWeight) * (251 - int(num))),
originaltitle, title, int(year), img, info,
))
#print result
return contentList
'''
- Video Values:
- genre : string (Comedy)
- year : integer (2009)
- episode : integer (4)
- season : integer (1)
- top250 : integer (192)
- rating : float (6.4) - range is 0..10
- cast : list (Michal C. Hall)
- castandrole : list (Michael C. Hall|Dexter)
- director : string (Dagur Kari)
- mpaa : string (PG-13)
- plot : string (Long Description)
- plotoutline : string (Short Description)
- title : string (Big Fan)
- originaltitle : string (Big Fan)
- sorttitle : string (Big Fan)
- duration : string (3:18)
- studio : string (Warner Bros.)
- tagline : string (An awesome movie) - short description of movie
- writer : string (Robert D. Siegel)
- tvshowtitle : string (Heroes)
- premiered : string (2005-03-04)
- status : string (Continuing) - status of a TVshow
- code : string (tt0110293) - IMDb code
- aired : string (2008-12-07)
- credits : string (Andy Kaufman) - writing credits
- lastplayed : string (Y-m-d h:m:s = 2009-04-05 23:16:04)
- album : string (The Joshua Tree)
- artist : list (['U2'])
- votes : string (12345 votes)
- trailer : string (/home/user/trailer.avi)
- dateadded : string (Y-m-d h:m:s = 2009-04-05 23:16:04)
'''
Binary file not shown.
+91
View File
@@ -0,0 +1,91 @@
# -*- 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 Content, re
class EZTV(Content.Content):
category_dict = {
'hot': ('Hot & New', '/', {'page': '/page_%d', 'increase': 1, 'second_page': 1}),
}
baseurl = "https://eztv.it"
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', 'https://eztv.it/'), ('Accept-Encoding', 'gzip')]
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 1
def isLabel(self):
return True
def isScrappable(self):
return False
def isInfoLink(self):
return True
def isPages(self):
return True
def isSearchOption(self):
return False
def get_contentList(self, category, subcategory=None, page=None):
contentList = []
url = self.get_url(category, subcategory, page, self.baseurl)
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
#print response
if category in ['hot']:
contentList = self.mode(response)
#print str(contentList)
return contentList
def mode(self, response):
contentList = []
#print str(result)
num = 51
result = re.compile(
r'''class="epinfo">(.+?)</a>.+?<a href="(magnet.+?)"''',
re.DOTALL).findall(response)
for title, link in result:
#main
info = {}
num = num - 1
original_title = None
year = 0
img = ''
#info
info['label'] = info['title'] = title
info['link'] = link
contentList.append((
int(int(self.sourceWeight) * (int(num))),
original_title, title, int(year), img, info,
))
return contentList
Binary file not shown.
+146
View File
@@ -0,0 +1,146 @@
# -*- 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 re
import Content
from BeautifulSoup import BeautifulSoup
class FastTorrent(Content.Content):
category_dict = {
#'movies':('Movies', '/popular/'),
'tvshows': (
'TV Shows', '/last-tv-torrent/', {'page': '/last-tv-torrent/%d.html', 'increase': 1, 'second_page': 2}),
'cartoons': ('Cartoons', '/last-multfilm-torrent/',
{'page': '/last-multfilm-torrent/%d.html', 'increase': 1, 'second_page': 2}),
'anime': ('Anime', '/anime/multfilm/', {'page': '/anime/multfilm/%d.html', 'increase': 1, 'second_page': 2}),
'hot': ('Hot & New', '/new-films/', {'page': '/new-films/%d.html', 'increase': 1, 'second_page': 2}),
'genre': {'genre': 'by Genre',
'amime_series': ('Anime Series', '/anime-serialy/multfilm/',
{'page': '/anime-serialy/multfilm/%d.html', 'increase': 1, 'second_page': 2}),
}
#'top':('Top 250 Movies', '/top/'),
}
baseurl = "http://www.fast-torrent.ru"
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', baseurl), ('Accept-Encoding', 'gzip'), ('Accept-Language', 'ru,en;q=0.8')]
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 1
def isLabel(self):
return False
def isScrappable(self):
return True
def isSearchOption(self):
return True
def isInfoLink(self):
return False
def isPages(self):
return True
def get_contentList(self, category, subcategory=None, page=None):
contentList = []
if not subcategory or subcategory == True:
get = self.category_dict[category]
else:
get = self.category_dict[category][subcategory]
if not page or page == 1:
url = self.baseurl + get[1]
else:
property = self.get_property(category, subcategory)
page_url = property['page'] % (property['second_page'] + ((page - 2) * property['increase']))
url = self.baseurl + str(page_url)
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
#print response
if category: # in ['hot']:
contentList = self.popmode(response)
#print str(contentList)
return contentList
def popmode(self, response):
contentList = []
Soup = BeautifulSoup(response.decode('utf-8'))
result = Soup.findAll('div', {'class': 'film-wrap'})
num = 16
for tr in result:
#main
info = {}
num = num - 1
original_title = None
year = 0
h2 = tr.find('h2')
#print str(h2)
label = h2.find('span', {'itemprop': 'name'})
if label:
title = label.text
year = re.compile('\((\d\d\d\d)\)').findall(h2.text)
if year:
year = year[0]
original_title = h2.find('span', {'itemprop': 'alternativeHeadline'})
if original_title:
original_title = original_title.text
else:
try:
title, year, original_title = \
re.compile(u'<h2>(.+?) \((\d\d\d\d)\) <br.*?>\((.+?)\)<', re.DOTALL | re.I).findall(unicode(h2))[0]
except:
try:
title, year = re.compile(u'<h2>(.+?) \((\d\d\d\d)\)<', re.DOTALL | re.I).findall(unicode(h2))[0]
except:
pass
a = tr.find('div', 'film-image').find('a')
link = a.get('href')
img = a.get('style')
if img:
img = img.replace('background: url(', '').rstrip(')')
#info
info['label'] = title
info['link'] = link
info['title'] = title
genre = tr.find('div', 'film-genre').text
tv = [u'Зарубежный сериал', u'Русский сериал', u'Аниме сериалы', u'Мультсериалы']
for i in tv:
if re.search(i, genre):
info['tvshowtitle'] = title
info['year'] = int(year)
contentList.append((
int(int(self.sourceWeight) * (int(num))),
original_title, title, int(year), img, info,
))
return contentList
Binary file not shown.
+248
View File
@@ -0,0 +1,248 @@
# -*- 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 re
import HTMLParser
import Content
from BeautifulSoup import BeautifulSoup
class IMDB(Content.Content):
category_dict = {
'movies': ('Forieng Movies', '/search/title?languages=en|1&title_type=feature&sort=moviemeter,asc'),
'rus_movies': ('Russian Movies', '/search/title?languages=ru|1&title_type=feature&sort=moviemeter,asc'),
'tvshows': ('TV Shows', '/search/title?count=100&title_type=tv_series,mini_series&ref_=gnr_tv_mp'),
'cartoons': ('Cartoons', '/search/title?genres=animation&title_type=feature&sort=moviemeter,asc'),
'anime': ('Anime',
'/search/title?count=100&genres=animation&keywords=anime&num_votes=1000,&explore=title_type&ref_=gnr_kw_an'),
'hot': ('Hot & New', '/search/title?count=100&title_type=feature%2Ctv_series%2Ctv_movie&ref_=nv_ch_mm_1'),
'top': ('Top 250 Movies', '/chart/top/'),
'search': ('[B]Search[/B]', '/find?q=%s&s=tt&ttype=ft'),
'year': {'year': 'by Year', },
'genre': {'genre': 'by Genre',
'action': ('Action', '/genre/action'),
'adventure': ('Adventure', '/genre/adventure'),
'animation': ('Animation', '/genre/animation'),
'biography': ('Biography', '/genre/biography'),
'comedy': ('Comedy', '/genre/comedy'),
'crime': ('Crime', '/genre/crime'),
'documentary': ('Documentary', '/genre/documentary'),
'drama': ('Drama', '/genre/drama'),
'family': ('Family', '/genre/family'),
'fantasy': ('Fantasy', '/genre/fantasy'),
'film_noir': ('Film-Noir', '/genre/film_noir'),
'history': ('History', '/genre/history'),
'horror': ('Horror', '/genre/horror'),
'music': ('Music', '/genre/music'),
'musical': ('Musical', '/genre/musical'),
'mystery': ('Mystery', '/genre/mystery'),
'romance': ('Romance', '/genre/romance'),
'sci_fi': ('Sci-Fi', '/genre/sci_fi'),
'short': ('Short', '/genre/short'),
'sport': ('Sport', '/genre/sport'),
'thriller': ('Thriller', '/genre/thriller'),
'war': ('War', '/genre/war'),
'western': ('Western', '/genre/western'),
}
}
for y in range(2015, 1970, -1):
category_dict['year'][str(y)] = (str(y), '/year/%s/' % str(y))
regex_list = []
baseurl = "http://imdb.com"
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', baseurl), ('Accept-Encoding', 'gzip'), ('Accept-Language', 'ru,en;q=0.8')]
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 2
def isLabel(self):
return False
def isPages(self):
return False
def isSearchOption(self):
return True
def isScrappable(self):
return True
def get_contentList(self, category, subcategory=None, page=None):
contentList = []
url = self.get_url(category, subcategory, page, self.baseurl)
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
#print response
if category in ['top']:
contentList = self.topmode(response)
elif category == 'search':
contentList = self.searchmode(response)
else: #if category in ['genre']:
contentList = self.genremode(response)
#print str(contentList)
return contentList
def searchmode(self, response):
contentList = []
pars = HTMLParser.HTMLParser()
Soup = BeautifulSoup(response)
result = Soup.findAll('tr', {'class': ['findResult odd', 'findResult even']})
num = 250
for tr in result:
#main
info = {}
year = 0
num = num - 1
title = pars.unescape(tr.findAll('a')[1].text)
tdtitle = tr.find('td', 'result_text')
#print str(tdtitle.text.encode('utf-8'))
originaltitle = tr.find('i')
if originaltitle:
originaltitle = originaltitle.text
try:
year = re.compile('\((\d\d\d\d)\)').findall(tdtitle.text)[0]
except:
try:
year = re.compile('(\d\d\d\d)').findall(tdtitle.text)[0]
except:
pass
info['tvshowtitle'] = title
img = self.biggerImg(tr.find('img').get('src'))
contentList.append((
int(int(self.sourceWeight) * (251 - int(num))),
originaltitle, title, int(year), img, info,
))
#print result
return contentList
def genremode(self, response):
contentList = []
pars = HTMLParser.HTMLParser()
Soup = BeautifulSoup(response)
result = Soup.findAll('tr', {'class': ['odd detailed', 'even detailed']})
for tr in result:
#main
info = {}
year = 0
tdtitle = tr.find('td', 'title')
num = tr.find('td', 'number').text.rstrip('.')
originaltitle = None
title = pars.unescape(tdtitle.find('a').text)
try:
year = re.compile('\((\d\d\d\d)\)').findall(tdtitle.find('span', 'year_type').text)[0]
except:
try:
year = re.compile('(\d\d\d\d)').findall(tdtitle.find('span', 'year_type').text)[0]
except:
pass
info['tvshowtitle'] = title
img = self.biggerImg(tr.find('td', 'image').find('img').get('src'))
#info
info['code'] = tr.find('span', 'wlb_wrapper').get('data-tconst')
contentList.append((
int(int(self.sourceWeight) * (251 - int(num))),
originaltitle, title, int(year), img, info,
))
#print result
return contentList
def biggerImg(self, img):
if img and '._' in img:
img = img.split('._')[0] + '._V1_SY_CR1,0,,_AL_.jpg'
return img
def topmode(self, response):
contentList = []
Soup = BeautifulSoup(response)
result = Soup.findAll('tr', {'class': ['odd', 'even']})
for tr in result:
#main
tdtitle = tr.find('td', 'titleColumn')
num = tdtitle.find('span', {'name': 'ir'}).text.rstrip('.')
originaltitle = None
title = tdtitle.find('a').text
year = tdtitle.find('span', {'name': 'rd'}).text.rstrip(')').lstrip('(')
tdposter = tr.find('td', 'posterColumn')
img = self.biggerImg(tdposter.find('img').get('src'))
#info
info = {}
info['title'] = title
info['year'] = int(year)
info['code'] = tr.find('div', 'wlb_ribbon').get('data-tconst')
contentList.append((
int(int(self.sourceWeight) * (251 - int(num))),
originaltitle, title, int(year), img, info,
))
#print result
return contentList
'''
- Video Values:
- genre : string (Comedy)
- year : integer (2009)
- episode : integer (4)
- season : integer (1)
- top250 : integer (192)
- rating : float (6.4) - range is 0..10
- cast : list (Michal C. Hall)
- castandrole : list (Michael C. Hall|Dexter)
- director : string (Dagur Kari)
- mpaa : string (PG-13)
- plot : string (Long Description)
- plotoutline : string (Short Description)
- title : string (Big Fan)
- originaltitle : string (Big Fan)
- sorttitle : string (Big Fan)
- duration : string (3:18)
- studio : string (Warner Bros.)
- tagline : string (An awesome movie) - short description of movie
- writer : string (Robert D. Siegel)
- tvshowtitle : string (Heroes)
- premiered : string (2005-03-04)
- status : string (Continuing) - status of a TVshow
- code : string (tt0110293) - IMDb code
- aired : string (2008-12-07)
- credits : string (Andy Kaufman) - writing credits
- lastplayed : string (Y-m-d h:m:s = 2009-04-05 23:16:04)
- album : string (The Joshua Tree)
- artist : list (['U2'])
- votes : string (12345 votes)
- trailer : string (/home/user/trailer.avi)
- dateadded : string (Y-m-d h:m:s = 2009-04-05 23:16:04)
'''
Binary file not shown.
+310
View File
@@ -0,0 +1,310 @@
# -*- 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 re
import socket
import Content
from BeautifulSoup import BeautifulSoup
class KinoPoisk(Content.Content):
category_dict = {
'tvshows': ('TV Shows', '/top/serial/list/'),
'cartoons': ('Cartoons', '/top/id_genre/14/'),
'search': ('[B]Search[/B]', '/s/type/film/list/1/find/%s/'),
'movies': ('Forieng Movies', '/s/type/film/list/1/m_act[country]/1/m_act[type]/film/'),
'rus_movies': ('Russian Movies', '/s/type/film/list/1/m_act[country]/2/m_act[type]/film/'),
'anime': ('Anime', '/s/type/film/list/1/order/rating/m_act[genre][0]/1750/',),
'hot': ('Hot & New', '/popular/'),
'top': ('Top 250 Movies', '/top/'),
'genre': {'genre': 'by Genre',
'russia': ('Russia & USSR', '/top/rus/list/'),
'biography': ('Biography', '/s/type/film/list/1/m_act[genre][0]/22/'),
'action': ('Action', '/top/id_genre/3/'),
'thriller': ('Thriller', '/top/id_genre/4/'),
'comedy': ('Comedy', '/top/id_genre/6/'),
'drama': ('Drama', '/top/id_genre/8/'),
'romance': ('Romance', '/top/id_genre/7/'),
'horror': ('Horror', '/top/id_genre/1/'),
'sci_fi': ('Sci-Fi', '/top/id_genre/2/'),
'documentary': ('Documentary', '/top/id_genre/12/'),
'cartoonseries': ('Cartoons Series', '/top/mult_serial/list/'),
'cartoonshort': ('Cartoons Short', '/top/short_mult/list/'),
'short': ('Short', '/top/short/list/'),
'male': ('Male', '/top/sex/male/'),
'female': ('Female', '/top/sex/female/'),
}
}
for category in category_dict.keys():
if isinstance(category_dict.get(category), dict):
for subcategory in category_dict.get(category).keys():
if subcategory != category:
x = category_dict[category][subcategory]
if x[1].startswith('/s/type/film/list/'):
category_dict[category][subcategory] = (x[0], x[1] + 'perpage/25/',
{'page': x[1] + 'perpage/25/page/%d/', 'increase': 1,
'second_page': 2})
if not isinstance(category_dict.get(category), dict):
x = category_dict[category]
if x[1].startswith('/s/type/film/list/'):
category_dict[category] = (
x[0], x[1] + 'perpage/25/', {'page': x[1] + 'perpage/25/page/%d/', 'increase': 1, 'second_page': 2})
category_dict['year'] = {'year': 'by Year', }
for y in range(2015, 1970, -1):
category_dict['year'][str(y)] = (str(y), '/s/type/film/list/1/m_act[year]/%s/' % str(y) + 'perpage/25/',
{'page': '/s/type/film/list/1/m_act[year]/%s/' % str(y) + 'perpage/25/page/%d/',
'increase': 1, 'second_page': 2})
baseurl = "http://www.kinopoisk.ru"
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', baseurl), ('Accept-Encoding', 'gzip'), ('Accept-Language', 'ru,en;q=0.8')]
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 2
def isLabel(self):
return False
def isPages(self):
return True
def isSearchOption(self):
return True
def isScrappable(self):
return True
def get_contentList(self, category, subcategory=None, page=None):
socket.setdefaulttimeout(15)
contentList = []
url = self.get_url(category, subcategory, page, self.baseurl)
#print url
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
#print response
if category in ['hot']:
contentList = self.popmode(response)
elif url.startswith(self.baseurl + '/s/type/film/list/'):
contentList = self.infomode(response)
else:
contentList = self.topmode(response)
#print str(contentList)
return contentList
def stripTtl(self, title):
bad_end = [u'\(ТВ\)', u'\(сериал\)', u'\(видео\)']
for code in bad_end:
title = re.sub(u' ' + code + '$', '', title)
return title
def popmode(self, response):
contentList = []
Soup = BeautifulSoup(response)
result = Soup.find('div', 'stat').findAll('div', 'el')
#print str(result)
for tr in result:
#main
a = tr.findAll('a')
num = a[0].text
#print num
info = {}
year = 0
img = ''
originaltitle = tr.find('i')
if originaltitle:
originaltitle = self.stripHtml(self.unescape(originaltitle.text))
title = a[1].text
link = a[1].get('href')
if link:
id = re.compile('/film/(\d+)/').findall(link)
if id:
img = self.id2img(id[0])
try:
title, year = re.compile('(.+?) \((\d\d\d\d)\)', re.DOTALL).findall(a[1].text)[0]
except:
pass
if not year:
try:
title, year = re.compile('(.+?) \(.*(\d\d\d\d)').findall(a[1].text)[0]
info['tvshowtitle'] = title
except:
pass
title = self.stripHtml(self.stripTtl(title))
#info
info['title'] = title
info['year'] = int(year)
contentList.append((
int(int(self.sourceWeight) * (201 - int(num))),
originaltitle, title, int(year), img, info,
))
return contentList
def topmode(self, response):
contentList = []
Soup = BeautifulSoup(response)
result = Soup.find('table', {'cellpadding': '3'}).findAll('tr')[2:]
#print str(result)
for tr in result:
#main
td = tr.findAll('td')
year = 0
info = {}
img = ''
title, originaltitle = None, None
num = td[0].text.rstrip('.')
originaltitle = tr.find('span', 'text-grey')
if originaltitle:
originaltitle = self.stripHtml(self.unescape(originaltitle.text))
a_all = tr.find('a', {'class': 'all'})
if a_all:
link = a_all.get('href')
if link:
id = re.compile('/film/(\d+)/').findall(link)
if id:
img = self.id2img(id[0])
year = re.compile('(.+) \((\d\d\d\d)\)').findall(a_all.text)
if not year:
try:
title, year = re.compile('(.+) \(.*(\d\d\d\d)').findall(a_all.text)[0]
info['tvshowtitle'] = title
except:
title = a_all.text
else:
title, year = year[0]
title = self.stripHtml(self.stripTtl(title))
#info
if originaltitle and not title:
title = originaltitle
originaltitle = None
if title:
info['title'] = title
info['year'] = int(year)
contentList.append((
int(int(self.sourceWeight) * (251 - int(num))),
originaltitle, title, int(year), img, info,
))
return contentList
def infomode(self, response):
contentList = []
Soup = BeautifulSoup(response)
result = Soup.findAll('div', 'info')
#print str(result)
num = 0
for div in result:
#main
info = {}
img = ''
name = div.find('p', 'name')
title = name.find('a').text
link = name.find('a').get('href')
if link:
id = re.compile('/film/(\d+)/').findall(link)
if id:
img = self.id2img(id[0])
year = name.find('span', 'year') if name.find('span', 'year') else 0
if year:
year=year.text
ysplit = year.split(' ')
if len(ysplit) > 1: year = ysplit[0]
title = self.stripHtml(self.unescape(title))
tvshowtitle = re.compile(u'(.+?) \((.+?)\)$').findall(title)
if tvshowtitle and tvshowtitle[0][1] in [u'сериал']:
title = tvshowtitle[0][0]
info['tvshowtitle'] = title
num = num + 1
originaltitle = div.find('span', 'gray')
if originaltitle:
originaltitle = re.match('(.+?), \d', originaltitle.text)
if originaltitle:
originaltitle = self.stripHtml(self.unescape(originaltitle.group(1)))
title = self.stripTtl(title)
#info
info['title'] = title
info['year'] = int(year)
contentList.append((
int(int(self.sourceWeight) * (100 - int(num))),
originaltitle, title, int(year), img, info,
))
return contentList
def id2img(self, id):
if id:
return "http://st.kp.yandex.net/images/film_iphone/iphone360_%s.jpg" % (str(id))
else:
return ''
'''
- Video Values:
- genre : string (Comedy)
- year : integer (2009)
- episode : integer (4)
- season : integer (1)
- top250 : integer (192)
- tracknumber : integer (3)
- rating : float (6.4) - range is 0..10
- watched : depreciated - use playcount instead
- playcount : integer (2) - number of times this item has been played
- overlay : integer (2) - range is 0..8. See GUIListItem.h for values
- cast : list (Michal C. Hall)
- castandrole : list (Michael C. Hall|Dexter)
- director : string (Dagur Kari)
- mpaa : string (PG-13)
- plot : string (Long Description)
- plotoutline : string (Short Description)
- title : string (Big Fan)
- originaltitle : string (Big Fan)
- sorttitle : string (Big Fan)
- duration : string (3:18)
- studio : string (Warner Bros.)
- tagline : string (An awesome movie) - short description of movie
- writer : string (Robert D. Siegel)
- tvshowtitle : string (Heroes)
- premiered : string (2005-03-04)
- status : string (Continuing) - status of a TVshow
- code : string (tt0110293) - IMDb code
- aired : string (2008-12-07)
- credits : string (Andy Kaufman) - writing credits
- lastplayed : string (Y-m-d h:m:s = 2009-04-05 23:16:04)
- album : string (The Joshua Tree)
- artist : list (['U2'])
- votes : string (12345 votes)
- trailer : string (/home/user/trailer.avi)
- dateadded : string (Y-m-d h:m:s = 2009-04-05 23:16:04)
'''
Binary file not shown.
+110
View File
@@ -0,0 +1,110 @@
# -*- 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 Content
from BeautifulSoup import BeautifulSoup
class RiperAM(Content.Content):
category_dict = {
#'movies':('Movies', '/popular/'),
#'tvshows':('TV Shows', '/top/serial/list/'),
#'cartoons':('Cartoons', '/top/id_genre/14/'),
#'anime':('Anime', '/search/title?count=100&genres=animation&keywords=anime&num_votes=1000,&explore=title_type&ref_=gnr_kw_an'),
'hot': ('Hot & New', '/', {'page': '/portal.php?tp=%d', 'increase': 30, 'second_page': 30}),
#'top':('Top 250 Movies', '/top/'),
}
baseurl = "http://www.riper.am"
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://www.riper.am/'), ('Accept-Encoding', 'gzip,deflate,sdch'),
('Accept-Language', 'ru,en;q=0.8')]
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 1
def isLabel(self):
return True
def isScrappable(self):
return False
def isInfoLink(self):
return True
def isPages(self):
return True
def isSearchOption(self):
return False
def get_contentList(self, category, subcategory=None, page=None):
contentList = []
url = self.get_url(category, subcategory, page, self.baseurl)
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
#print response
if category in ['hot']:
contentList = self.popmode(response)
#print str(contentList)
return contentList
def popmode(self, response):
contentList = []
Soup = BeautifulSoup(response)
result = Soup.findAll('table', 'postbody postbody_portal')
#print str(result)
num = 31
bad_forum = [u'Безопасность', u'Книги и журналы', u'Action & Shooter', u'RPG/MMORPG']
for tr in result:
#main
info = {}
forum = tr.find('div', {'style': 'height:20px;overflow:hidden;'}).find('a').text
if forum and forum in bad_forum:
continue
link = tr.find('div', {'style': 'width:200px;overflow:hidden;'}).find('a').get('href')
num = num - 1
label = tr.find('strong').text
original_title = None
year = 0
title = self.unescape(label)
img = tr.findAll('a')[0].find('img').get('src')
if img:
img = img.replace('.webp', '.jpg')
#info
info['label'] = label
info['link'] = link
info['title'] = title
info['year'] = int(year)
contentList.append((
int(int(self.sourceWeight) * (int(num))),
original_title, title, int(year), img, info,
))
return contentList
Binary file not shown.