fix cinemalibero
This commit is contained in:
+55
-62
@@ -6,7 +6,7 @@ import base64
|
|||||||
import re
|
import re
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
from channels import autoplay
|
from channels import autoplay, support
|
||||||
from channels import filtertools
|
from channels import filtertools
|
||||||
from core import scrapertools, servertools, httptools
|
from core import scrapertools, servertools, httptools
|
||||||
from platformcode import logger, config
|
from platformcode import logger, config
|
||||||
@@ -18,14 +18,14 @@ from core import tmdb
|
|||||||
# Necessario per Autoplay
|
# Necessario per Autoplay
|
||||||
IDIOMAS = {'Italiano': 'IT'}
|
IDIOMAS = {'Italiano': 'IT'}
|
||||||
list_language = IDIOMAS.values()
|
list_language = IDIOMAS.values()
|
||||||
list_servers = ['wstream', 'openload', 'streamango', 'akstream', 'clipwatching', 'cloudvideo', 'youtube']
|
list_servers = ['akstream', 'wstream', 'openload', 'streamango']
|
||||||
list_quality = ['default']
|
list_quality = ['default']
|
||||||
|
|
||||||
# Necessario per Verifica Link
|
# Necessario per Verifica Link
|
||||||
__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'cinemalibero')
|
__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'cinemalibero')
|
||||||
__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'cinemalibero')
|
__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'cinemalibero')
|
||||||
|
|
||||||
host = 'https://www.cinemalibero.center'
|
host = 'https://www.cinemalibero.icu'
|
||||||
|
|
||||||
headers = [['Referer', host]]
|
headers = [['Referer', host]]
|
||||||
|
|
||||||
@@ -37,47 +37,20 @@ def mainlist(item):
|
|||||||
autoplay.init(item.channel, list_servers, list_quality) # Necessario per Autoplay
|
autoplay.init(item.channel, list_servers, list_quality) # Necessario per Autoplay
|
||||||
|
|
||||||
# Menu Principale
|
# Menu Principale
|
||||||
itemlist = [Item(channel=item.channel,
|
itemlist = []
|
||||||
action='video',
|
support.menu(itemlist, 'Film bold', 'video', host+'/category/film/')
|
||||||
title='Film',
|
support.menu(itemlist, 'Generi submenu', 'genres', host)
|
||||||
url=host+'/category/film/',
|
support.menu(itemlist, 'Cerca film submenu', 'search', host)
|
||||||
contentType='movie',
|
support.menu(itemlist, 'Serie TV bold', 'video', host+'/category/serie-tv/', contentType='episode')
|
||||||
thumbnail=''),
|
support.menu(itemlist, 'Anime submenu', 'video', host+'/category/anime-giapponesi/', contentType='episode')
|
||||||
Item(channel=item.channel,
|
support.menu(itemlist, 'Cerca serie submenu', 'search', host, contentType='episode')
|
||||||
action='sottomenu_film',
|
support.menu(itemlist, 'Sport bold', 'video', host+'/category/sport/')
|
||||||
title='Generi Film',
|
|
||||||
url=host,
|
|
||||||
contentType='movie',
|
|
||||||
thumbnail=''),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action='video',
|
|
||||||
title='Serie TV',
|
|
||||||
url=host+'/category/serie-tv/',
|
|
||||||
contentType='episode',
|
|
||||||
extra='tv',
|
|
||||||
thumbnail=''),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action='video',
|
|
||||||
title='Anime',
|
|
||||||
url=host+'/category/anime-giapponesi/',
|
|
||||||
contentType='episode',
|
|
||||||
thumbnail=''),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action='video',
|
|
||||||
title='Sport',
|
|
||||||
url=host+'/category/sport/',
|
|
||||||
contentType='movie',
|
|
||||||
thumbnail=''),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action='search',
|
|
||||||
title='[B]Cerca...[/B]',
|
|
||||||
thumbnail=''),
|
|
||||||
]
|
|
||||||
|
|
||||||
autoplay.show_option(item.channel, itemlist) # Necessario per Autoplay (Menu Configurazione)
|
autoplay.show_option(item.channel, itemlist) # Necessario per Autoplay (Menu Configurazione)
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def search(item, texto):
|
def search(item, texto):
|
||||||
logger.info("[cinemalibero.py] " + item.url + " search " + texto)
|
logger.info("[cinemalibero.py] " + item.url + " search " + texto)
|
||||||
item.url = host + "/?s=" + texto
|
item.url = host + "/?s=" + texto
|
||||||
@@ -91,13 +64,20 @@ def search(item, texto):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def genres(item):
|
||||||
|
return support.scrape(item, patron_block=r'<div id="bordobar" class="dropdown-menu(.*?)</li>', patron=r'<a class="dropdown-item" href="([^"]+)" title="([A-z]+)"', listGroups=['url', 'title'], action='video')
|
||||||
|
|
||||||
|
|
||||||
def video(item):
|
def video(item):
|
||||||
logger.info('[cinemalibero.py] video')
|
logger.info('[cinemalibero.py] video')
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|
||||||
|
if host not in item.url:
|
||||||
|
item.url = host + item.url
|
||||||
|
|
||||||
# Carica la pagina
|
# Carica la pagina
|
||||||
data = httptools.downloadpage(item.url).data.replace('\n','').replace('\t','')
|
data = httptools.downloadpage(item.url).data.replace('\n','').replace('\t','')
|
||||||
block = scrapertools.find_single_match(data, '<div class="container">.*?class="col-md-12">(.*?)<div class=(?:"container"|"bg-dark ")>')
|
block = scrapertools.find_single_match(data, '<div class="container">.*?class="col-md-12[^"]*?">(.*?)<div class=(?:"container"|"bg-dark ")>')
|
||||||
|
|
||||||
# Estrae i contenuti
|
# Estrae i contenuti
|
||||||
matches = re.compile(r'<div class="col-lg-3">(.*?)<\/a><\/div>', re.DOTALL).findall(block)
|
matches = re.compile(r'<div class="col-lg-3">(.*?)<\/a><\/div>', re.DOTALL).findall(block)
|
||||||
@@ -133,7 +113,7 @@ def video(item):
|
|||||||
else:
|
else:
|
||||||
tipologia = 'movie'
|
tipologia = 'movie'
|
||||||
action = 'select'
|
action = 'select'
|
||||||
|
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel,
|
Item(channel=item.channel,
|
||||||
action=action,
|
action=action,
|
||||||
@@ -143,7 +123,7 @@ def video(item):
|
|||||||
quality=quality,
|
quality=quality,
|
||||||
url=url,
|
url=url,
|
||||||
thumbnail=thumb,
|
thumbnail=thumb,
|
||||||
infoLabels=year,
|
infoLabels={'year': year},
|
||||||
show=title))
|
show=title))
|
||||||
|
|
||||||
# Next page
|
# Next page
|
||||||
@@ -202,6 +182,9 @@ def findvideos(item): # Questa def. deve sempre essere nominata findvideos
|
|||||||
logger.info('[cinemalibero.py] findvideos')
|
logger.info('[cinemalibero.py] findvideos')
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|
||||||
|
if item.args == 'direct':
|
||||||
|
return servertools.find_video_items(item)
|
||||||
|
|
||||||
if item.contentType == 'episode':
|
if item.contentType == 'episode':
|
||||||
data = item.url.lower()
|
data = item.url.lower()
|
||||||
block = scrapertools.find_single_match(data,r'>streaming.*?<\/strong>*?<\/h2>(.*?)<\/div>')
|
block = scrapertools.find_single_match(data,r'>streaming.*?<\/strong>*?<\/h2>(.*?)<\/div>')
|
||||||
@@ -252,15 +235,14 @@ def findvideos(item): # Questa def. deve sempre essere nominata findvideos
|
|||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def episodios(item): # Questa def. deve sempre essere nominata episodios
|
def episodios(item): # Questa def. deve sempre essere nominata episodios
|
||||||
logger.info('[cinemalibero.py] episodios')
|
logger.info('[cinemalibero.py] episodios')
|
||||||
itemlist = []
|
itemlist = []
|
||||||
extra =''
|
extra = ''
|
||||||
|
|
||||||
# Carica la pagina
|
# Carica la pagina
|
||||||
data = httptools.downloadpage(item.url, headers=headers).data
|
data = httptools.downloadpage(item.url, headers=headers).data
|
||||||
block = scrapertools.find_single_match(data, r'<div class="col-md-8 bg-white rounded-left p-5"><div>(.*?)<\/div>')
|
block = scrapertools.find_single_match(data, r'<div class="col-md-8 bg-white rounded-left p-5"><div>(.*?)at-below-post')
|
||||||
if re.findall('rel="category tag">serie', data, re.IGNORECASE):
|
if re.findall('rel="category tag">serie', data, re.IGNORECASE):
|
||||||
# logger.info('select = ### è una serie ###')
|
# logger.info('select = ### è una serie ###')
|
||||||
extra='serie'
|
extra='serie'
|
||||||
@@ -268,9 +250,6 @@ def episodios(item): # Questa def. deve sempre essere nominata episodios
|
|||||||
if re.findall('episodi', block, re.IGNORECASE):
|
if re.findall('episodi', block, re.IGNORECASE):
|
||||||
# logger.info('select = ### è un anime ###')
|
# logger.info('select = ### è un anime ###')
|
||||||
extra='anime'
|
extra='anime'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
block = re.sub(r'<h2>.*?<\/h2>','',block)
|
block = re.sub(r'<h2>.*?<\/h2>','',block)
|
||||||
block = block.replace('<p>','').replace('<p style="text-align: left;">','').replace('–<','<').replace('-<','<').replace('–<','<').replace('– <','<').replace('<strong>','<stop><start><strong>')+'<stop>'
|
block = block.replace('<p>','').replace('<p style="text-align: left;">','').replace('–<','<').replace('-<','<').replace('–<','<').replace('– <','<').replace('<strong>','<stop><start><strong>')+'<stop>'
|
||||||
@@ -280,21 +259,35 @@ def episodios(item): # Questa def. deve sempre essere nominata episodios
|
|||||||
if extra == 'serie':
|
if extra == 'serie':
|
||||||
block = block.replace('<br /> <a','<a')
|
block = block.replace('<br /> <a','<a')
|
||||||
matches = re.compile(r'<start>.*?(?:stagione|Stagione)(.*?)<\/(?:strong|span)><\/p>(.*?)<stop>', re.DOTALL).findall(block)
|
matches = re.compile(r'<start>.*?(?:stagione|Stagione)(.*?)<\/(?:strong|span)><\/p>(.*?)<stop>', re.DOTALL).findall(block)
|
||||||
|
|
||||||
for lang, html in matches:
|
|
||||||
lang = re.sub('<.*?>','',lang)
|
|
||||||
html = html.replace('<br />','\n').replace('</p>','\n')
|
|
||||||
|
|
||||||
matches = re.compile(r'([^<]+)([^\n]+)\n', re.DOTALL).findall(html)
|
if not matches:
|
||||||
for scrapedtitle, html in matches:
|
matches = scrapertools.find_multiple_matches(block, r'<a href="([^"]+)"[^>]+>(Episodio [0-9]+)</a>')
|
||||||
|
for scrapedurl, scrapedtitle in matches:
|
||||||
|
scrapedtitle = re.sub(r'Episodio ([0-9]+)', r'Episodio 1x\1', scrapedtitle)
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel,
|
Item(channel=item.channel,
|
||||||
action="findvideos",
|
action="findvideos",
|
||||||
contentType='episode',
|
contentType='episode',
|
||||||
title=scrapedtitle + ' - (' + lang + ')',
|
title=scrapedtitle,
|
||||||
fulltitle=scrapedtitle,
|
fulltitle=scrapedtitle,
|
||||||
show=scrapedtitle,
|
show=item.fulltitle,
|
||||||
url=html))
|
url=scrapedurl,
|
||||||
|
args='direct'))
|
||||||
|
else:
|
||||||
|
for lang, html in matches:
|
||||||
|
lang = re.sub('<.*?>','',lang)
|
||||||
|
html = html.replace('<br />','\n').replace('</p>', '\n')
|
||||||
|
|
||||||
|
matches = re.compile(r'([^<]+)([^\n]+)\n', re.DOTALL).findall(html)
|
||||||
|
for scrapedtitle, html in matches:
|
||||||
|
itemlist.append(
|
||||||
|
Item(channel=item.channel,
|
||||||
|
action="findvideos",
|
||||||
|
contentType='episode',
|
||||||
|
title=scrapedtitle + ' - (' + lang + ')',
|
||||||
|
fulltitle=scrapedtitle,
|
||||||
|
show=item.fulltitle,
|
||||||
|
url=html))
|
||||||
|
|
||||||
elif extra == 'anime':
|
elif extra == 'anime':
|
||||||
block = re.sub(r'<start.*?(?:download:|Download:).*?<stop>','',block)
|
block = re.sub(r'<start.*?(?:download:|Download:).*?<stop>','',block)
|
||||||
@@ -310,7 +303,7 @@ def episodios(item): # Questa def. deve sempre essere nominata episodios
|
|||||||
contentType='episode',
|
contentType='episode',
|
||||||
title=scrapedtitle,
|
title=scrapedtitle,
|
||||||
fulltitle=scrapedtitle,
|
fulltitle=scrapedtitle,
|
||||||
show=scrapedtitle,
|
show=item.fulltitle,
|
||||||
url=html))
|
url=html))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user