KoD 1.7.7

- fix di routine ai canali/server\n\n
This commit is contained in:
marco
2023-06-30 19:39:03 +02:00
parent c3e02636fb
commit d29efd4ec2
68 changed files with 1784 additions and 543 deletions
+1 -1
View File
@@ -115,7 +115,7 @@ def peliculas(item):
action = 'seasons'
patron = r'<img src="(?P<thumb>[^"]+)(?:[^>]+>){4}\s*<a href="(?P<url>[^"]+)[^>]+>(?P<title>[^<]+)'
if (item.args == 'search' or item.contentType != 'movie') and inspect.stack(0)[4][3] not in ['get_channel_results']:
if (item.args == 'search' or item.contentType != 'movie') and not support.stackCheck(['get_channel_results']):
patronNext = None
def itemlistHook(itemlist):
lastUrl = support.match(data, patron=r'href="([^"]+)">Last').match
+29 -10
View File
@@ -4,14 +4,13 @@
# ------------------------------------------------------------
import cloudscraper, json, copy, inspect
from core import jsontools, support
from core import jsontools, support, httptools
from platformcode import autorenumber
session = cloudscraper.create_scraper()
# support.dbg()
host = support.config.get_channel_url()
response = session.get(host + '/archivio')
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
response = httptools.downloadpage(host + '/archivio')
csrf_token = support.match(response.data, patron='name="csrf-token" content="([^"]+)"').match
headers = {'content-type': 'application/json;charset=UTF-8',
'x-csrf-token': csrf_token,
'Cookie' : '; '.join([x.name + '=' + x.value for x in response.cookies])}
@@ -153,7 +152,7 @@ def peliculas(item):
item.args['order'] = order_list[order]
payload = json.dumps(item.args)
records = session.post(host + '/archivio/get-animes', headers=headers, data=payload).json()['records']
records = httptools.downloadpage(host + '/archivio/get-animes', headers=headers, post=payload).json['records']
for it in records:
if not it['title']:
it['title'] = ''
@@ -225,8 +224,28 @@ def episodios(item):
def findvideos(item):
itemlist = [item.clone(title='StreamingCommunityWS', server='streamingcommunityws', url=str(item.scws_id))]
# itemlist = [item.clone(title='StreamingCommunityWS', server='streamingcommunityws', url=str(item.scws_id)),
# item.clone(title=support.config.get_localized_string(30137), server='directo', url=item.video_url)]
return support.server(item, itemlist=itemlist, referer=False)
if item.scws_id:
from time import time
from base64 import b64encode
from hashlib import md5
client_ip = support.httptools.downloadpage('http://ip-api.com/json/').json.get('query')
expires = int(time() + 172800)
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
url = 'https://scws.work/master/{}?token={}&expires={}&n=1'.format(item.scws_id, token, expires)
itemlist = [item.clone(title=support.config.get_localized_string(30137), url=url, server='directo', action='play')]
return support.server(item, itemlist=itemlist)
def play(item):
urls = list()
info = support.match(item.url, patron=r'(http.*?rendition=(\d+)[^\s]+)').matches
if info:
for url, res in info:
urls.append(['hls [{}]'.format(res), url])
return urls
+9
View File
@@ -7,6 +7,15 @@
"banner": "animeworld.png",
"categories": ["anime", "vos"],
"settings": [
{
"id": "lang",
"type": "list",
"label": "Lingua di Ricerca",
"default": 0,
"enabled": true,
"visible": true,
"lvalues": [ "Tutte", "Ita", "Sub-Ita"]
},
{
"id": "order",
"type": "list",
+17 -12
View File
@@ -4,7 +4,7 @@
# thanks to fatshotty
# ----------------------------------------------------------
from core import httptools, support, jsontools
from core import httptools, support, config, jsontools
host = support.config.get_channel_url()
__channel__ = 'animeworld'
@@ -23,7 +23,7 @@ def get_data(item):
# support.dbg()
url = httptools.downloadpage(item.url, headers=headers, follow_redirects=True, only_headers=True).url
data = support.match(url, headers=headers, follow_redirects=True).data
if 'AWCookieVerify' in data:
if 'SecurityAW' in data:
get_cookie(data)
data = get_data(item)
return data
@@ -37,8 +37,8 @@ def order():
@support.menu
def mainlist(item):
anime=['/filter?sort=',
('ITA',['/filter?dub=1&sort=', 'menu', '1']),
('SUB-ITA',['/filter?dub=0&sort=', 'menu', '0']),
('ITA',['/filter?dub=1&sort=', 'menu', 'dub=1']),
('SUB-ITA',['/filter?dub=0&sort=', 'menu', 'dub=0']),
('In Corso', ['/ongoing', 'peliculas','noorder']),
('Ultimi Episodi', ['/updated', 'peliculas', 'updated']),
('Nuove Aggiunte',['/newest', 'peliculas','noorder' ]),
@@ -50,6 +50,7 @@ def mainlist(item):
def genres(item):
action = 'peliculas'
data = get_data(item)
patronBlock = r'dropdown[^>]*>\s*Generi\s*<span.[^>]+>(?P<block>.*?)</ul>'
patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)</label>'
@@ -75,9 +76,10 @@ def menu(item):
def submenu(item):
action = 'peliculas'
data = item.other
# debug=True
patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)<\/label>'
def itemHook(item):
item.url = host + '/filter?' + item.name + '=' + item.value + '&dub=' + item.args + ('&sort=' if item.name != 'sort' else '')
item.url = '{}/filter?{}={}&{}{}'.format(host, item.name, item.value, item.args, ('&sort=' if item.name != 'sort' else ''))
return item
return locals()
@@ -85,9 +87,10 @@ def submenu(item):
def newest(categoria):
support.info(categoria)
item = support.Item()
lang = config.get_setting('lang', channel=item.channel)
try:
if categoria == "anime":
item.url = host + '/updated'
item.url = host
item.args = "updated"
return peliculas(item)
# Continua la ricerca in caso di errore
@@ -98,13 +101,13 @@ def newest(categoria):
return []
def search(item, texto):
support.info(texto)
def search(item, text):
support.info(text)
if item.search:
item.url = host + '/filter?dub=' + item.args + '&keyword=' + texto + '&sort='
item.url = '{}/filter?{}&keyword={}&sort='.format(host, item.args, text)
else:
item.args = 'noorder'
item.url = host + '/search?keyword=' + texto
lang = ['?', '?dub=1&', '?dub=0&'][config.get_setting('lang', channel=item.channel)]
item.url = '{}/filter{}&keyword={}&sort='.format(host, lang, text)
item.contentType = 'tvshow'
try:
return peliculas(item)
@@ -118,8 +121,8 @@ def search(item, texto):
@support.scrape
def peliculas(item):
data = get_data(item)
anime = True
# debug = True
if item.args not in ['noorder', 'updated'] and not item.url[-1].isdigit(): item.url += order() # usa l'ordinamento di configura canale
data = get_data(item)
@@ -185,7 +188,9 @@ def findvideos(item):
else:
dataJson = support.match(host + '/api/episode/info?id=' + epID + '&alt=0', headers=headers).data
json = jsontools.load(dataJson)
title = support.match(json['grabber'], patron=r'server\d+.([^.]+)', string=True).match
if title: itemlist.append(item.clone(action="play", title=title, url=json['grabber'].split('=')[-1], server='directo'))
else: urls.append(json['grabber'])
# support.info(urls)
return support.server(item, urls, itemlist)
+1 -1
View File
@@ -34,4 +34,4 @@
"lvalues": ["10", "20", "30", "40", "50", "60", "80", "90"]
}
]
}
}
+3 -3
View File
@@ -45,9 +45,9 @@ def peliculas(item):
@support.scrape
def episodios(item):
patronBlock = r'<div class="tab-pane fade" id="season-(?P<season>.)"(?P<block>.*?)</ul>\s*</div>'
patron = r'<a href="#" allowfullscreen data-link="(?P<url>[^"]+).*?title="(?P<title>[^"]+)(?P<lang>[sS][uU][bB]-?[iI][tT][aA])?\s*">(?P<episode>[^<]+)'
patron = r'(?P<data><a href="#" allowfullscreen data-link="[^"]+.*?title="(?P<title>[^"]+)(?P<lang>[sS][uU][bB]-?[iI][tT][aA])?\s*">(?P<episode>[^<]+).*?</li>)'
action = 'findvideos'
# debugBlock = True
# debug = True
return locals()
@@ -68,4 +68,4 @@ def search(item, text):
def findvideos(item):
logger.debug()
return support.server(item, item.url)
return support.server(item, item.data)
+2
View File
@@ -57,7 +57,9 @@ def peliculas(item):
def itemHook(item):
if not sceneTitle:
item.title = item.title.replace('_', ' ')
item.fulltitle = item.fulltitle.replace('_', ' ')
item.title = support.scrapertools.decodeHtmlentities(support.urlparse.unquote(item.title))
return item
if 'search' not in item.args:
+10 -11
View File
@@ -6,23 +6,22 @@
from core import support, httptools
from platformcode import config
host = config.get_channel_url()
headers = [['Referer', host]]
host = config.get_channel_url()
headers = [['Referer', host]]
@support.menu
def mainlist(item):
menu = [
('Film', ['/film/', 'list', 'film']),
('Per Genere', ['', 'list', 'genere']),
('Al Cinema', ['/cinema/', 'list', 'film']),
('Sottotitolati', ['/sub-ita/', 'list', 'film']),
('Top del Mese', ['/top-del-mese.html', 'list', 'film'])
menu = [
('Film', ['/film/', 'list', 'film']),
('Per Genere', ['', 'list', 'genere']),
('Al Cinema', ['/cinema/', 'list', 'film']),
('Sub-ITA', ['/sub-ita/', 'list', 'film']),
('Top del Mese', ['/top-del-mese.html', 'list', 'film'])
]
search = ''
return locals()
return locals()
@support.scrape
@@ -64,7 +63,7 @@ def findvideos(item):
urls = []
data = support.match(item).data
matches = support.match(data, patron=r'<iframe.*?src="([^"]+)').matches
for m in matches:
if 'youtube' not in m and not m.endswith('.js'):
urls += support.match(m, patron=r'data-link="([^"]+)').matches
+18 -27
View File
@@ -4,7 +4,8 @@
# ------------------------------------------------------------
import requests
from core import support
from core import support, httptools
from platformcode import logger
DRM = 'com.widevine.alpha'
key_widevine = "https://la7.prod.conax.cloud/widevine/license"
@@ -27,7 +28,7 @@ def mainlist(item):
('Replay {bold}', ['', 'replay_channels'])]
menu = [('Programmi TV {bullet bold}', ['/tutti-i-programmi', 'peliculas', '', 'tvshow']),
('Teche La7 {bullet bold}', ['/i-protagonisti', 'peliculas', '', 'tvshow'])]
('Teche La7 {bullet bold}', ['/la7teche', 'peliculas', '', 'tvshow'])]
search = ''
return locals()
@@ -83,13 +84,18 @@ def search(item, text):
@support.scrape
def peliculas(item):
search = item.search
action = 'episodios'
pagination = 20
disabletmdb = True
addVideolibrary = False
downloadEnabled = False
action = 'episodios'
patron = r'<a href="(?P<url>[^"]+)"[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]+)"></div><div class="titolo">\s*(?P<title>[^<]+)<'
if 'la7teche' in item.url:
patron = r'<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)" class="teche-i-img".*?url\(\'(?P<thumb>[^\']+)'
def itemHook(item):
item.thumbnail = 'http:' + item.t if item.t.startswith('//') else item.t if item.t else item.thumbnail
item.fanart = item.thumb
return item
return locals()
@@ -97,33 +103,18 @@ def peliculas(item):
@support.scrape
def episodios(item):
data = support.match(item).data
# debug = True
action = 'findvideos'
if '>puntate<' in data:
patronBlock = r'>puntate<(?P<block>.*?)home-block-outbrain'
url = support.match(data, patron=r'>puntate<[^>]+>[^>]+>[^>]+><a href="([^"]+)"').match
data += support.match(host + url).data
else:
item.url += '/video'
data = support.match(item).data
patron = r'(?:<a href="(?P<url>[^"]+)">[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]*)">[^>]+>[^>]+>[^>]+>(?:[^>]+>)?(?:[^>]+>){6}?)\s*(?P<title>[^<]+)<(?:[^>]+>[^>]+>[^>]+><div class="data">(?P<date>[^<]+))?|class="heading">[^>]+>(?P<Title>[^<]+).*?window.shareUrl = "(?P<Url>[^"]+)".*?poster:\s*"(?P<Thumb>[^"]+)", title: "(?P<desc>[^"]+)"'
patronNext = r'<a href="([^"]+)">'
addVideolibrary = False
downloadEnabled = False
def itemHook(item):
if item.Thumb: item.t = item.Thumb
item.thumbnail = 'http:' + item.t if item.t.startswith('//') else item.t if item.t else item.thumbnail
if item.Title: item.title = support.typo(item.Title, 'bold')
if item.date:
item.title = support.re.sub(r'[Pp]untata (?:del )?\d+/\d+/\d+', '', item.title)
item.title += support.typo(item.date, '_ [] bold')
if item.desc: item.plot = item.desc
item.forcethumb = True
item.fanart = item.thumbnail
return item
if 'la7teche' in item.url:
patron = r'<a href="(?P<url>[^"]+)">\s*<div class="holder-bg">.*?data-background-image="(?P<thumb>[^"]+)(?:[^>]+>){4}\s*(?P<title>[^<]+)(?:(?:[^>]+>){2}\s*(?P<plot>[^<]+))?'
else:
data = str(support.match(item.url, patron=r'"home-block home-block--oggi(.*?)</section>').matches)
data += httptools.downloadpage(item.url + '/video').data
patron = r'item[^>]+>\s*<a href="(?P<url>[^"]+)">.*?image="(?P<thumb>[^"]+)(?:[^>]+>){4,5}\s*(?P<title>[\d\w][^<]+)(?:(?:[^>]+>){7}\s*(?P<title2>[\d\w][^<]+))?'
patronNext = r'<a href="([^"]+)">'
return locals()
+17 -20
View File
@@ -9,37 +9,33 @@ host = 'https://metalvideo.com'
headers = {'X-Requested-With': 'XMLHttpRequest'}
@support.scrape
@support.menu
def mainlist(item):
menu = [('Generi',['', 'genres']),
('Ultimi Video',['/videos/latest', 'peliculas']),
('Top Video',['/videos/top', 'peliculas']),
('Cerca...',['','search',])]
return locals()
@support.scrape
def genres(item):
item.url = host
action = 'peliculas'
patronBlock = r'<ul class="dropdown-menu(?P<block>.*?)</ul>\s*</div'
patron = r'<a href="(?P<url>[^"]+)"(?: class="")?>(?P<title>[^<]+)<'
patronBlock = r'<div class="swiper-slide">(?P<block>.*?)<button'
patron = r'class="" href="(?P<url>[^"]+)[^>]+>(?P<title>[^<]+)<'
def itemHook(item):
item.thumbnail = support.thumb('music')
item.contentType = 'music'
return item
def itemlistHook(itemlist):
itemlist.pop(0)
itemlist.append(
support.Item(
channel=item.channel,
title=support.typo('Cerca...', 'bold'),
contentType='music',
url=item.url,
action='search',
thumbnail=support.thumb('search')))
support.channel_config(item, itemlist)
return itemlist
return locals()
@support.scrape
def peliculas(item):
# debug=True
action = 'findvideos'
patron= r'<img src="[^"]+" alt="(?P<title>[^"]+)" data-echo="(?P<thumb>[^"]+)"(?:[^>]+>){7}<a href="(?P<url>[^"]+)"'
patronNext = r'<a href="([^"]+)">(?:&raquo|»)'
patron= r'<a href="(?P<url>[^"]+)"[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt="(?P<title>[^"]+)"[^>]*>'
patronNext = r'<a href="([^"]+)" data-load="[^"]+" class="[^"]+" title="Next'
typeContentDict = {'': 'music'}
def itemHook(item):
item.contentType = 'music'
@@ -49,12 +45,13 @@ def peliculas(item):
def findvideos(item):
return support.server(item, Videolibrary=False)
data = support.match(item, patron=r'<source src="[^"]+').match
return support.server(item, Videolibrary=False, data=data)
def search(item, text):
support.info(text)
item.url = host + '/search.php?keywords=' + text + '&video-id='
item.url = host + '/search?keyword=' + text
try:
return peliculas(item)
# Continua la ricerca in caso di errore
+13 -12
View File
@@ -22,16 +22,17 @@ def mainlist(item):
top = [('Dirette {bold}', ['/dirette', 'live', '/palinsesto/onAir.json']),
('Replay {bold}', ['/guidatv', 'replayMenu', '/guidatv.json'])]
menu = [('Film {bullet bold}', ['/film', 'menu', '/tipologia/film/index.json']),
('Serie italiane {bullet bold}', ['/serietv', 'menu', '/tipologia/serieitaliane/index.json']),
# ('Fiction {bullet bold}', ['/fiction', 'menu', '/tipologia/fiction/index.json']),
('Documentari {bullet bold}', ['/documentari', 'menu', '/tipologia/documentari/index.json']),
('Programmi TV{bullet bold}', ['/programmi', 'menu', '/tipologia/programmi/index.json']),
('Programmi per Bambini {bullet bold}', ['/bambini', 'menu', '/tipologia/bambini/index.json']),
('Teen {bullet bold}', ['/teen', 'menu', '/tipologia/teen/index.json']),
('Learning {bullet bold}', ['/learning', 'menu', '/tipologia/learning/index.json']),
('Teche Rai {bullet bold storia}', ['/techerai', 'menu', '/tipologia/techerai/index.json']),
('Musica e Teatro {bullet bold}', ['/musica-e-teatro', 'menu', '/tipologia/musica-e-teatro/index.json'])
menu = [('Film {bold}', ['/film', 'menu', '/tipologia/film/index.json']),
('Serie italiane {bold}', ['/serieitaliane', 'menu', '/tipologia/serieitaliane/index.json']),
('Serie Internazionali {bold}', ['/serieinternazionali', 'menu', '/tipologia/serieinternazionali/index.json']),
('Programmi TV{bold}', ['/programmi', 'menu', '/tipologia/programmi/index.json']),
('Documentari {bold}', ['/documentari', 'menu', '/tipologia/documentari/index.json']),
('Bambini {bold}', ['/bambini', 'menu', '/tipologia/bambini/index.json']),
('Teen {bold}', ['/teen', 'menu', '/tipologia/teen/index.json']),
('Musica e Teatro {bold}', ['/musica-e-teatro', 'menu', '/tipologia/musica-e-teatro/index.json']),
('Teche Rai {bold storia}', ['/techerai', 'menu', '/tipologia/techerai/index.json']),
('Learning {bold}', ['/learning', 'menu', '/tipologia/learning/index.json']),
('Rai Italy{bold tv}', ['/raiitaly', 'menu', '/tipologia/raiitaly/index.json'])
]
search = ''
@@ -41,6 +42,7 @@ def mainlist(item):
def menu(item):
logger.debug()
itemlist = []
item.disable_videolibrary = True
action = 'peliculas'
@@ -60,7 +62,6 @@ def menu(item):
action = 'menu'
thumb = support.thumb('genres')
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), data=it.get('contents', item.data), thumbnail=thumb, action=action))
return itemlist
@@ -256,7 +257,7 @@ def getUrl(url):
elif url.startswith("/"): url = host + url
url = url.replace(".html?json", ".json").replace("/?json",".json").replace("?json",".json").replace(" ", "%20")
logger.debug('URL', url)
return url
+3 -5
View File
@@ -223,7 +223,7 @@ def episodios(item):
action='findvideos',
contentType='episode',
contentSerieName=item.fulltitle,
url='{}/watch/{}?e={}'.format(host, se['title_id'], ep['id'])))
url='{}/iframe/{}?episode_id={}'.format(host, se['title_id'], ep['id'])))
if config.get_setting('episode_info') and not support.stackCheck(['add_tvshow', 'get_newest']):
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
@@ -235,10 +235,8 @@ def episodios(item):
def findvideos(item):
support.callAds('https://thaudray.com/5/3523301', host)
# Fix for old items in videolibrary
if item.episodeid and item.episodeid not in item.url:
item.url += item.episodeid
itemlist = [item.clone(title=channeltools.get_channel_parameters(item.channel)['title'], url=item.url, server='streamingcommunityws')]
itemlist = [item.clone(title=channeltools.get_channel_parameters(item.channel)['title'],
url=item.url.replace('/watch/', '/iframe/'), server='streamingcommunityws')]
return support.server(item, itemlist=itemlist, referer=False)
+1 -2
View File
@@ -3,9 +3,8 @@
# Canale per Tantifilm
# ------------------------------------------------------------
from core import scrapertools, httptools, support
from core import support
from core.item import Item
from core.support import info
from platformcode import logger
from platformcode import config
+14 -47
View File
@@ -13,12 +13,10 @@ headers = [['Referer', host]]
@support.menu
def mainlist(item):
# top = [('Novità',['', 'peliculas', 'new', 'tvshow']),
# ('Aggiornamenti', ['', 'peliculas', 'last', 'tvshow'])]
# tvshow = ['/category/serie-tv/']
anime =['/category/anime/']
# ('Sub-Ita',['/category/anime-sub-ita/', 'peliculas', 'sub']),
# ('Film Animati',['/category/film-animazione/','peliculas', '', 'movie'])]
anime =['/category/anime',
('ITA',['/lista-anime-ita','peliculas',]),
('Sub-ITA',['/lista-anime-sub-ita', 'peliculas'])]
# ('Film Animati',['/lista-anime-ita','peliculas', '', 'movie'])]
search = ''
return locals()
@@ -39,52 +37,28 @@ def search(item, text):
return []
def newest(categoria):
support.info(categoria)
item = support.Item()
try:
item.contentType = 'undefined'
item.url= host
item.args= 'new'
return peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
support.logger.error("{0}".format(line))
return []
@support.scrape
def peliculas(item):
# debugBlock = True
# debug = True
# search = item.text
if item.contentType != 'movie': anime = True
anime = True
action = 'check'
blacklist = ['-Film Animazione disponibili in attesa di recensione ']
if item.action == 'search':
pagination = ''
#patronBlock = '"lcp_catlist"[^>]+>(?P<block>.*)</ul>'
patronBlock = '<main[^>]+>(?P<block>.*?)</ma'
#patron = r'href="(?P<url>[^"]+)" title="(?P<title>[^"]+)"'
patron = r'<a href="(?P<url>[^"]+)"[^>]*>(?P<title>[^<]+)<[^>]+>[^>]+>\s*<div'
elif item.args == 'last':
patronBlock = '(?:Aggiornamenti|Update)</h2>(?P<block>.*?)</ul>'
patron = r'<a href="(?P<url>[^"]+)">\s*<img[^>]+src[set]{0,3}="(?P<thumbnail>[^ ]+)[^>]+>\s*<span[^>]+>(?P<title>[^<]+)'
deflang = 'ITA' if 'sub' not in item.url else 'Sub-ITA'
if 'lista' in item.url:
pagination = 20
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)'
else:
patronBlock = '<main[^>]+>(?P<block>.*)</main>'
# patron = r'<a href="(?P<url>[^"]+)" rel="bookmark">(?P<title>[^<]+)</a>[^>]+>[^>]+>[^>]+><img.*?src="(?P<thumb>[^"]+)".*?<p>(?P<plot>[^<]+)</p>.*?<span class="cat-links">Pubblicato in.*?.*?(?P<type>(?:[Ff]ilm|</artic))[^>]+>'
patron = r'<a href="(?P<url>[^"]+)" rel="bookmark">(?P<title>[^<]+)</a>(:?[^>]+>){3}(?:<img.*?src="(?P<thumb>[^"]+)")?.*?<p>(?P<plot>[^<]+)</p>.*?tag">.*?(?P<type>(?:[Ff]ilm|</art|Serie Tv))'
patron = r'(?i)<a href="(?P<url>[^"]+)" rel="bookmark">(?P<title>[^<]+)</a>(:?[^>]+>){3}(?:<img.*?src="(?P<thumb>[^"]+)")?.*?<p>(?P<plot>[^<]+)</p>.*?tag">.*?(?P<type>(?:film|serie|anime))(?P<cat>.*?)</span>'
typeContentDict={'movie':['film']}
typeActionDict={'findvideos':['film']}
patronNext = '<a class="next page-numbers" href="([^"]+)">'
def itemHook(item):
support.info(item.title)
if item.args == 'sub':
item.title += support.typo('Sub-ITA', 'bold color kod _ []')
if 'sub/ita' in item.cat.lower():
item.title = item.title.replace('[ITA]', '[Sub-ITA]')
item.contentLanguage = 'Sub-ITA'
return item
return locals()
@@ -101,18 +75,11 @@ def check(item):
def episodios(item):
anime = True
patron = r'>\s*(?:(?P<season>\d+)(?:&#215;|x|×))?(?P<episode>\d+)(?:\s+&#8211;\s+)?[ ]+(?P<title2>[^<]+)[ ]+<a (?P<data>.*?)(?:<br|</p)'
# if inspect.stack(0)[1][3] not in ['find_episodes']:
# from platformcode import autorenumber
# autorenumber.start(itemlist, item)
return locals()
def findvideos(item):
servers = support.server(item, data=item.data)
return servers
# return support.server(item, item.data if item.contentType != 'movie' else support.match(item.url, headers=headers).data )
return support.server(item, data=item.data)
def clean_title(title):
+117 -73
View File
@@ -3,93 +3,137 @@
# Canale per tunein
# ------------------------------------------------------------
from core import scrapertools, support
from core import httptools, support
from platformcode import logger
host = 'http://api.radiotime.com'
headers = [['Referer', host]]
args = 'formats=mp3,aac,ogg,flash,html,hls,wma&partnerId=RadioTime&itemToken='
@support.scrape
@support.menu
def mainlist(item):
item.url = host
action = 'radio'
patron = r'text="(?P<title>[^"]+)" URL="(?P<url>[^"]+)"'
def itemHook(item):
item.thumbnail = support.thumb('music')
item.contentType = 'music'
return item
def itemlistHook(itemlist):
itemlist.append(
item.clone(title=support.typo('Cerca...', 'bold color kod'), action='search', thumbnail=support.thumb('search')))
support.channel_config(item, itemlist)
return itemlist
menu = [('Musica {bullet music}' ,['/categories/music?{}'.format(args), 'radio', '', 'music']),
('Sport {bullet music}' ,['/categories/sports?{}'.format(args), 'radio', '', 'music']),
('Notizie e Dibattiti {bullet music}' ,['/categories/c57922?{}'.format(args), 'radio', '' 'music']),
('Podcast {bullet music}' ,['/categories/c100000088?{}'.format(args), 'radio', '', 'music']),
('Audiolibri {bullet music}' ,['/categories/c100006408?{}'.format(args), 'radio', '', 'music']),
('Luogo {bullet music}' ,['/categories/regions?{}'.format(args), 'radio', '', 'music']),
('Lingua {bullet music}' ,['/categories/languages?{}'.format(args), 'radio', '', 'music'])]
search =''
return locals()
def radio(item):
support.info()
itemlist = []
data = support.match(item, patron= r'text="(?P<title>[^\("]+)(?:\((?P<location>[^\)]+)\))?" URL="(?P<url>[^"]+)" bitrate="(?P<quality>[^"]+)" reliability="[^"]+" guide_id="[^"]+" subtext="(?P<song>[^"]+)" genre_id="[^"]+" formats="(?P<type>[^"]+)" (?:playing="[^"]+" )?(?:playing_image="[^"]+" )?(?:show_id="[^"]+" )?(?:item="[^"]+" )?image="(?P<thumb>[^"]+)"')
if data.matches:
for title, location, url, quality, song, type, thumbnail in data.matches:
title = scrapertools.decodeHtmlentities(title)
itemlist.append(
item.clone(title = support.typo(title, 'bold') + support.typo(quality + ' kbps','_ [] bold color kod'),
thumbnail = thumbnail,
url = url,
contentType = 'music',
plot = support.typo(location, 'bold') + '\n' + song,
action = 'findvideos'))
else:
matches = support.match(data.data, patron= r'text="(?P<title>[^\("]+)(?:\([^\)]+\))?" URL="(?P<url>[^"]+)" (?:guide_id="[^"]+" )?(?:stream_type="[^"]+" )?topic_duration="(?P<duration>[^"]+)" subtext="(?P<plot>[^"]+)" item="[^"]+" image="(?P<thumb>[^"]+)"').matches
if matches:
for title, url, duration, plot, thumbnail in matches:
title = scrapertools.unescape(title)
infoLabels={}
infoLabels['duration'] = duration
itemlist.append(
item.clone(title = support.typo(title, 'bold'),
thumbnail = thumbnail,
infolLbels = infoLabels,
url = url,
contentType = 'music',
plot = plot,
action = 'findvideos'))
else:
matches = support.match(data.data, patron= r'text="(?P<title>[^"]+)" URL="(?P<url>[^"]+)"').matches
for title, url in matches:
title = scrapertools.unescape(title)
itemlist.append(
item.clone(channel = item.channel,
title = support.typo(title, 'bold'),
thumbnail = item.thumbnail,
url = url,
action = 'radio'))
support.nextPage(itemlist, item, data.data, r'(?P<url>[^"]+)" key="nextStations')
return itemlist
def findvideos(item):
import xbmc
itemlist = []
item.action = 'play'
urls = support.match(item.url).data.strip().split()
for url in urls:
item.url= url
item.server = 'directo'
itemlist.append(item)
return itemlist
def search(item, text):
support.info(text)
item.url = host + '/Search.ashx?query=' +text
itemlist = list()
try:
return radio(item)
js = httptools.downloadpage('{}/profiles?fullTextSearch=true&query={}&{}'.format(host, text, args)).json
data = js.get('Items', {})
for c in data:
if c.get('Pivots',{}).get('More',{}).get('Url', ''):
data = httptools.downloadpage(c.get('Pivots',{}).get('More',{}).get('Url', '')).json.get('Items',{})
else:
data = c.get('Children')
if data:
itemlist.extend(buildItemList(item, data))
if js.get('Paging', {}).get('Next'):
support.nextPage(itemlist, item, next_page=js.get('Paging', {}).get('Next'))
return itemlist
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
logger.error(line)
return []
def radio(item):
itemlist = list()
js = dict()
if item.data:
data = item.data
else:
js = httptools.downloadpage(item.url).json
data = js.get('Items', {})
itemlist = buildItemList(item, data)
if js.get('Paging', {}).get('Next'):
support.nextPage(itemlist, item, next_page=js.get('Paging', {}).get('Next'))
return itemlist
def buildItemList(item, data):
itemlist = list()
# support.dbg()
for c in data:
item.data = ''
item.action = 'radio'
token = c.get('Context',{}).get('Token','')
if not token:
token = c.get('Actions', {}).get('Context',{}).get('Token','')
if not c.get('Title', c.get('AccessibilityTitle')) or 'premium' in c.get('Title', c.get('AccessibilityTitle')).lower():
continue
if c.get('Children'):
if len(data) > 1:
if c.get('Pivots',{}).get('More',{}).get('Url', ''):
itm = item.clone(title=c.get('Title', c.get('AccessibilityTitle')),
url=c.get('Pivots',{}).get('More',{}).get('Url', ''),
token=token)
else:
itm = item.clone(title=c.get('Title', c.get('AccessibilityTitle')),
data=c.get('Children'),
token=token)
else:
if c.get('Pivots',{}).get('More',{}).get('Url', ''):
data = httptools.downloadpage(c.get('Pivots',{}).get('More',{}).get('Url', '')).json.get('Items', {})
else:
data = c.get('Children')
return buildItemList(item, data)
elif c.get('GuideId'):
title = c.get('Title', c.get('AccessibilityTitle'))
plot = '[B]{}[/B]\n{}'.format(c.get('Subtitle', ''), c.get('Description', ''))
thumbnail = c.get('Image', '')
if c.get('GuideId').startswith('s'):
itm = item.clone(title=title,
plot=plot,
thumbnail=thumbnail,
url = 'http://opml.radiotime.com/Tune.ashx?render=json&id={}&{}{}'.format(c.get('GuideId'), args, token),
action = 'findvideos')
else:
itm = item.clone(title=title,
plot=plot,
thumbnail=thumbnail,
url = c.get('Actions', {}).get('Browse',{}).get('Url',''))
elif c.get('Actions', {}).get('Browse',{}).get('Url',''):
title = c.get('Title', c.get('AccessibilityTitle'))
itm = item.clone(title = title,
url = c.get('Actions', {}).get('Browse',{}).get('Url',''))
itemlist.append(itm)
return itemlist
def findvideos(item):
item.action = 'play'
js = httptools.downloadpage(item.url, cloudscraper=True).json.get('body', {})
video_urls = list()
for it in js:
video_urls.append(['m3u8 [{}]'.format(it.get('bitrate')), it.get('url')])
item.referer = False
item.server = 'directo'
item.video_urls = video_urls
return [item]