Streamingcommunity: non riprodurre ultimo contenuto quando il selezionato uscirà prossimamente
This commit is contained in:
@@ -3,10 +3,7 @@
|
|||||||
# Canale per AnimeSaturn
|
# Canale per AnimeSaturn
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
|
|
||||||
from lib import js2py
|
|
||||||
from core import support
|
from core import support
|
||||||
from platformcode import config
|
|
||||||
from platformcode.logger import debug
|
|
||||||
|
|
||||||
host = support.config.get_channel_url()
|
host = support.config.get_channel_url()
|
||||||
__channel__ = 'animesaturn'
|
__channel__ = 'animesaturn'
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ else:
|
|||||||
|
|
||||||
|
|
||||||
host = support.config.get_channel_url()
|
host = support.config.get_channel_url()
|
||||||
headers = {}
|
headers = {'user-agent': httptools.random_useragent(),
|
||||||
headers = {'user-agent':httptools.random_useragent(),
|
|
||||||
'referer': host + '/browse'}
|
'referer': host + '/browse'}
|
||||||
|
|
||||||
# def getHeaders(forced=False):
|
# def getHeaders(forced=False):
|
||||||
@@ -112,7 +111,6 @@ def newest(category):
|
|||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
if item.mainThumb: item.thumbnail = item.mainThumb
|
if item.mainThumb: item.thumbnail = item.mainThumb
|
||||||
@@ -138,7 +136,6 @@ def peliculas(item):
|
|||||||
headers['referer'] = host + '/search'
|
headers['referer'] = host + '/search'
|
||||||
records = requests.post(host + '/api/search', headers=headers, json=payload).json()['records']
|
records = requests.post(host + '/api/search', headers=headers, json=payload).json()['records']
|
||||||
|
|
||||||
|
|
||||||
if records and type(records[0]) == list:
|
if records and type(records[0]) == list:
|
||||||
js = []
|
js = []
|
||||||
for record in records:
|
for record in records:
|
||||||
@@ -152,7 +149,7 @@ def peliculas(item):
|
|||||||
else:
|
else:
|
||||||
recordlist.append(it)
|
recordlist.append(it)
|
||||||
|
|
||||||
itlist = [makeItem(i, it, item) for i, it in enumerate(items)]
|
# itlist = [makeItem(i, it, item) for i, it in enumerate(items)]
|
||||||
|
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
itlist = [executor.submit(makeItem, i, it, item) for i, it in enumerate(items)]
|
itlist = [executor.submit(makeItem, i, it, item) for i, it in enumerate(items)]
|
||||||
@@ -172,6 +169,7 @@ def peliculas(item):
|
|||||||
support.check_trakt(itemlist)
|
support.check_trakt(itemlist)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def makeItem(n, it, item):
|
def makeItem(n, it, item):
|
||||||
info = httptools.downloadpage(host + '/api/titles/preview/{}'.format(it['id']), headers=headers, post={}).json
|
info = httptools.downloadpage(host + '/api/titles/preview/{}'.format(it['id']), headers=headers, post={}).json
|
||||||
logger.debug(jsontools.dump(info))
|
logger.debug(jsontools.dump(info))
|
||||||
@@ -183,7 +181,6 @@ def makeItem(n, it, item):
|
|||||||
itm.language = lang
|
itm.language = lang
|
||||||
itm.year = info['release_date'].split('-')[0]
|
itm.year = info['release_date'].split('-')[0]
|
||||||
|
|
||||||
|
|
||||||
if itm.contentType == 'movie':
|
if itm.contentType == 'movie':
|
||||||
# itm.contentType = 'movie'
|
# itm.contentType = 'movie'
|
||||||
itm.fulltitle = itm.show = itm.contentTitle = title
|
itm.fulltitle = itm.show = itm.contentTitle = title
|
||||||
@@ -200,6 +197,7 @@ def makeItem(n, it, item):
|
|||||||
itm.n = n
|
itm.n = n
|
||||||
return itm
|
return itm
|
||||||
|
|
||||||
|
|
||||||
def episodios(item):
|
def episodios(item):
|
||||||
# getHeaders()
|
# getHeaders()
|
||||||
logger.debug()
|
logger.debug()
|
||||||
@@ -238,8 +236,9 @@ def episodios(item):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
support.callAds('https://thaudray.com/5/3523301', host)
|
support.callAds('https://thaudray.com/5/3523301', host)
|
||||||
# Fix for old items in videolibrary
|
# Fix for old items in videolibrary
|
||||||
if item.episodeid and not item.episodeid in item.url:
|
if item.episodeid and item.episodeid not in item.url:
|
||||||
item.url += item.episodeid
|
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, server='streamingcommunityws')]
|
||||||
return support.server(item, itemlist=itemlist, referer=False)
|
return support.server(item, itemlist=itemlist, referer=False)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from wsgiref import headers
|
|
||||||
from core import httptools, support, filetools
|
from core import httptools, support, filetools
|
||||||
from platformcode import logger, config
|
from platformcode import logger, config
|
||||||
UA = httptools.random_useragent()
|
UA = httptools.random_useragent()
|
||||||
@@ -8,11 +7,14 @@ UA = httptools.random_useragent()
|
|||||||
def test_video_exists(page_url):
|
def test_video_exists(page_url):
|
||||||
global scws_id
|
global scws_id
|
||||||
logger.debug('page url=', page_url)
|
logger.debug('page url=', page_url)
|
||||||
|
scws_id = ''
|
||||||
|
|
||||||
if page_url.isdigit():
|
if page_url.isdigit():
|
||||||
scws_id = page_url
|
scws_id = page_url
|
||||||
else:
|
else:
|
||||||
scws_id = support.match(page_url, patron=r'scws_id[^:]+:(\d+)').match
|
page = httptools.downloadpage(page_url)
|
||||||
|
if page.url == page_url: # se non esiste, reindirizza all'ultimo url chiamato esistente
|
||||||
|
scws_id = support.scrapertools.find_single_match(page.data, r'scws_id[^:]+:(\d+)')
|
||||||
|
|
||||||
if not scws_id:
|
if not scws_id:
|
||||||
return False, config.get_localized_string(70449) % 'StreamingCommunityWS'
|
return False, config.get_localized_string(70449) % 'StreamingCommunityWS'
|
||||||
|
|||||||
Reference in New Issue
Block a user