Merge branch 'master' into alpha

# Conflicts:
#	service.py
This commit is contained in:
mac12m99
2021-05-21 20:34:14 +02:00
15 changed files with 76 additions and 55 deletions

View File

@@ -21,7 +21,7 @@
"filmigratis": "https://filmigratis.org",
"guardaseriecam": "https://guardaserie.cam",
"guardaserieclick": "https://www.guardaserie.support",
"guardaserieicu": "https://guardaserie.asia",
"guardaserieicu": "https://guardaserie.agency",
"hd4me": "https://hd4me.net",
"ilcorsaronero": "https://ilcorsaronero.link",
"ilgeniodellostreaming": "https://ilgeniodellostreaming.ist",

View File

@@ -8,7 +8,27 @@ from core import support
from platformcode import config
host = support.config.get_channel_url()
headers={'X-Requested-With': 'XMLHttpRequest'}
__channel__ = 'animesaturn'
cookie = support.config.get_setting('cookie', __channel__)
headers = {'X-Requested-With': 'XMLHttpRequest', 'Cookie': cookie}
def get_cookie(data):
global cookie, headers
cookie = support.match(data, patron=r'document.cookie="([^\s]+)').match
support.config.set_setting('cookie', cookie, __channel__)
headers = [['Cookie', cookie]]
def get_data(item):
# support.dbg()
# url = support.match(item.url, headers=headers, follow_redirects=True, only_headers=True).url
data = support.match(item.url, headers=headers, follow_redirects=True).data
if 'ASCookie' in data:
get_cookie(data)
data = get_data(item)
return data
@support.menu
def mainlist(item):
@@ -96,6 +116,9 @@ def peliculas(item):
action = 'check'
page = None
post = "page=" + str(item.page if item.page else 1) if item.page and int(item.page) > 1 else None
data = get_data(item)
# debug = True
if item.args == 'top':
data = item.other

View File

@@ -12,20 +12,20 @@ cookie = support.config.get_setting('cookie', __channel__)
headers = [['Cookie', cookie]]
def get_cookie():
def get_cookie(data):
global cookie, headers
cookie = support.match(host, patron=r'document.cookie="([^\s]+)').match
cookie = support.match(data, patron=r'document.cookie="([^\s]+)').match
support.config.set_setting('cookie', cookie, __channel__)
headers = [['Cookie', cookie]]
if not cookie:
get_cookie()
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:
get_cookie(data)
data = get_data(item)
return data
@@ -49,7 +49,7 @@ def mainlist(item):
@support.scrape
def genres(item):
action = 'peliculas'
# data = get_data(item)
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>'
@@ -62,7 +62,7 @@ def genres(item):
@support.scrape
def menu(item):
action = 'submenu'
# data = get_data(item)
data = get_data(item)
patronMenu=r'<button[^>]+>\s*(?P<title>[A-Za-z0-9]+)\s*<span.[^>]+>(?P<other>.*?)</ul>'
def itemlistHook(itemlist):
itemlist.insert(0, item.clone(title=support.typo('Tutti','bold'), action='peliculas'))
@@ -118,16 +118,12 @@ def search(item, texto):
@support.scrape
def peliculas(item):
anime=True
# debug =True
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 = support.httptools.downloadpage(item.url, headers=headers).data
if 'AWCookietest' in data:
get_cookie()
data = support.match(item.url).data
data = get_data(item)
if item.args == 'updated':
# data = get_data(item)
item.contentType='episode'
patron=r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img.*?src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?[^>]+>[^>]+>\s*<div class="ep">[^\d]+(?P<episode>\d+)[^<]*</div>'
action='findvideos'
@@ -172,7 +168,7 @@ def findvideos(item):
itemlist = []
urls = []
# resp = support.match(get_data(item), headers=headers, patron=r'data-name="(\d+)">([^<]+)<')
resp = support.match(item, headers=headers, patron=r'data-name="(\d+)">([^<]+)<')
resp = support.match(get_data(item), headers=headers, patron=r'data-name="(\d+)">([^<]+)<')
data = resp.data
for ID, name in resp.matches:

View File

@@ -27,14 +27,14 @@ def mainlist(item):
('Generi', ['', 'menu', 'Film per Genere']),
('Anni', ['', 'menu', 'Film per Anno']),
('Paese', ['', 'menu', 'Film per Paese']),
('Ultimi Aggiornati', ['/lista-film-ultimi-100-film-aggiornati/', 'peliculas', 'newest']),
('Ultimi Aggiornati', ['/ultimi-100-film-aggiornati/', 'peliculas', 'newest']),
('Ultimi Aggiunti', ['/lista-film-ultimi-100-film-aggiunti/', 'peliculas', 'newest'])
]
tvshow = ['/serietv/',
('Per Lettera', ['/serietv/', 'menu', 'Serie-Tv per Lettera']),
('Per Genere', ['/serietv/', 'menu', 'Serie-Tv per Genere']),
('Per anno', ['/serietv/', 'menu', 'Serie-Tv per Anno']),
('Ultime Aggiornate', ['/serietv/', 'peliculas', 'newest'])
('Ultime Aggiornate', ['/serietv/ultime-100-serie-tv-aggiornate/', 'peliculas', 'newest'])
]
docu = [('Documentari {bullet bold}', ['/category/documentario/', 'peliculas']),
('HD {submenu} {documentari}', ['/category/hd-alta-definizione/documentario-hd/', 'peliculas'])
@@ -63,7 +63,7 @@ def newest(categoria):
else:
item.contentType = 'movie'
item.url = host + '/lista-film-ultimi-100-film-aggiunti/'
item.args = "newest"
item.args = "newest"
return peliculas(item)
# Continua la ricerca in caso di errore
except:
@@ -88,6 +88,7 @@ def search(item, text):
logger.error("%s" % line)
return []
@support.scrape
def peliculas(item):
# esclusione degli articoli 'di servizio'
@@ -97,21 +98,19 @@ def peliculas(item):
'Openload: la situazione. Benvenuto Verystream', 'Openload: lo volete ancora?',
'OSCAR ' + str(curYear) + ' &#x25b6; VOTA IL TUO FILM PREFERITO! &#x1f3ac;',
'Auguri di Buon Natale e Felice Anno Nuovo! &#8211; ' + str(curYear) + '!']
# debug= True
if 'newest' in item.args:
pagination = ''
patronBlock = r'sequex-page-left(?P<block>.*?)sequex-page-right'
if '/serietv/' not in item.url:
# debug = True
pagination = ''
patronBlock = r'Ultimi 100 film [^:]+:(?P<block>.*?)<\/td>'
patron = r'<a href="?(?P<url>[^">]+)"?>(?P<title>[^<([]+)(?:\[(?P<lang>Sub-ITA|B/N|SUB-ITA)\])?\s*(?:\[(?P<quality>HD|SD|HD/3D)\])?\s*\((?P<year>[0-9]{4})\)<\/a>'
patron = r'src="?(?P<thumb>[^ "]+)"? alt="?(?P<title>.*?)(?:\[(?P<quality>[a-zA-Z/]+)\]\s*)?(?:\[(?P<lang>Sub-ITA|ITA)\]\s*)?(?:\[(?P<quality2>[a-zA-Z/]+)\]\s*)?\((?P<year>\d{4})[^\)]*\)[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>\w+) [^ ]+ DURATA (?P<duration>[0-9]+)[^ ]+ [^ ]+ [A-Z ]+ (?P<plot>[^<]+)<'
action = 'findvideos'
else:
patronBlock = r'Ultime SerieTv aggiornate(?P<block>.*?)Lista'
patron = r'src=(?:")?(?P<thumb>[^ "]+)(?:")? alt=(?:")?(?P<title>.*?)(?: &#8211; \d+&#215;\d+)?(?:>|"| &#8211; )(?:(?P<lang>Sub-ITA|ITA))?[^>]*>.*?<a href=(?:")?(?P<url>[^" ]+)(?:")?.*?rpwe-summary[^>]*>(?P<genre>[^\(]*)\((?P<year>\d{4})[^\)]*\) (?P<plot>[^<]+)<'
action = 'episodios'
elif '/serietv/' not in item.url:
patron = r'<div class="card-image">\s*<a[^>]+>\s*<img src="(?P<thumb>[^" ]+)" alt[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="?(?P<url>[^" >]+)(?:\/|"|\s+)>(?P<title>[^<[(]+)(?:\[(?P<quality>[A-Za-z0-9/-]+)])? (?:\((?P<year>[0-9]{4})\))?[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<genre>[^<>&‖“]+)(?:[^ ]+\s*DURATA\s*(?P<duration>[0-9]+)[^>]+>[^>]+>[^>]+>(?P<plot>[^<>]+))?'
patron = r'<div class="card-image">\s*<a[^>]+>\s*<img src="(?P<thumb>[^" ]+)" alt[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="?(?P<url>[^" >]+)(?:\/|"|\s+)>(?P<title>[^<[(]+)(?:\[(?P<quality>[a-zA-Z/]+)\]\s*)?(?:\[(?P<lang>Sub-ITA|ITA)\]\s*)?(?:\[(?P<quality2>[a-zA-Z/]+)\]\s*)? (?:\((?P<year>[0-9]{4})\))?[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<genre>[^<>&‖“]+)(?:[^ ]+\s*DURATA\s*(?P<duration>[0-9]+)[^>]+>[^>]+>[^>]+>(?P<plot>[^<>]+))?'
action = 'findvideos'
else:
@@ -121,6 +120,12 @@ def peliculas(item):
patronNext = '<a class="?page-link"? href="?([^>"]+)"?><i class="fa fa-angle-right">'
def itemHook(item):
if item.quality2:
item.quality = item.quality2
item.title += support.typo(item.quality2, '_ [] color kod')
return item
return locals()

View File

@@ -48,12 +48,12 @@ def mainlist(item):
@support.scrape
def peliculas(item):
# debug=True
# debug = True
if item.args == 'search':
patron = r'<a href="(?P<url>[^"]+)" title="Permalink to\s*(?P<title>[^"]+) \((?P<year>[0-9]+)[^<]*\)[^"]*"[^>]+>\s*<img[^s]+src="(?P<thumb>[^"]+)".*?<div class="calitate">\s*<p>(?P<quality>[^<]+)<\/p>'
else:
patronNext = r'<a class="nextpostslink" rel="next" href="([^"]+)">'
patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>\s*<\/a>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+?)(?P<lang>[sS][uU][bB]\-[iI][tT][aA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)?'
patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*(?:<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>\s*)?<\/a>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+?)(?P<lang>[sS][uU][bB]\-[iI][tT][aA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)?'
patronBlock = r'<div id="main_col">(?P<block>.*?)<!\-\- main_col \-\->'
# if item.args != 'all' and item.args != 'search':

View File

@@ -244,11 +244,11 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
if scraped["plot"]:
infolabels['plot'] = plot
if scraped['duration']:
matches = scrapertools.find_multiple_matches(scraped['duration'],
dur = scrapertools.find_multiple_matches(scraped['duration'],
r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)')
for h, m in matches:
for h, m in dur:
scraped['duration'] = int(h) * 60 + int(m)
if not matches:
if not dur:
scraped['duration'] = scrapertools.find_single_match(scraped['duration'], r'(\d+)')
try:
infolabels['duration'] = int(scraped['duration']) * 60

View File

@@ -129,7 +129,7 @@ def cache_response(fn):
result = fn(*args)
else:
url = re.sub('&year=-', '', args[0])
url = args[0].replace('&year=-', '')
# if PY3: url = str.encode(url)
row = db['tmdb_cache'].get(url)
@@ -138,7 +138,7 @@ def cache_response(fn):
result = row[0]
# si no se ha obtenido información, llamamos a la funcion
if not result:
if not result.get('results'):
result = fn(*args)
db['tmdb_cache'][url] = [result, datetime.datetime.now()]

View File

@@ -593,7 +593,7 @@ class SqliteMultithread(Thread):
while time.time() - start_time < self.timeout:
if self._sqlitedict_thread_initialized or self.exception:
return
time.sleep(0.1)
time.sleep(0.01)
raise TimeoutError("SqliteMultithread failed to flag initialization withing %0.0f seconds." % self.timeout)

View File

@@ -35,9 +35,6 @@ def start():
def run(item=None):
logger.debug()
# for saving viewmode for precedent menu
platformtools.viewmodeMonitor()
if not item:
# Extract item from sys.argv
if sys.argv[2]:

View File

@@ -9,7 +9,7 @@ def test_video_exists(page_url):
global data
resp = httptools.downloadpage(page_url)
data = resp.data
if resp.code == 404:
if resp.code == 404 or 'Video is processing now' in data:
return False, config.get_localized_string(70449) % "Vidmoly"
return True, ""

View File

@@ -9,7 +9,7 @@ def test_video_exists(page_url):
page = httptools.downloadpage(page_url)
global data
data = page.data
if page.code == 404 or 'File is no longer available' in data:
if page.code == 404 or 'File is no longer available' in data or "We're sorry!" in data:
return False, config.get_localized_string(70449) % "VUP Player"
return True, ""

View File

@@ -21,7 +21,7 @@ def test_video_exists(page_url):
disable_directIP = False
# if 'swvideoid' in page_url: disable_directIP = True
resp = httptools.downloadpage(page_url, verify=False, disable_directIP=disable_directIP, follow_redirects=False)
resp = httptools.downloadpage(page_url.replace('https:', 'http:'), verify=False, disable_directIP=disable_directIP, follow_redirects=False)
while resp.headers.get('location'):
page_url = resp.headers.get('location')
resp = httptools.downloadpage(page_url.replace('https:', 'http:'), verify=False, disable_directIP=disable_directIP, follow_redirects=False)

View File

@@ -89,21 +89,18 @@ def update(path, p_dialog, i, t, serie, overwrite):
# serie.infoLabels['playcount'] = serie.playcount
insertados_total += insertados
except Exception as ex:
except:
import traceback
logger.error("Error when saving the chapters of the series")
template = "An exception of type %s occured. Arguments:\n%r"
message = template % (type(ex).__name__, ex.args)
logger.error(message)
logger.error(traceback.format_exc())
except Exception as ex:
except:
import traceback
logger.error("Error in obtaining the episodes of: %s" % serie.show)
template = "An exception of type %s occured. Arguments:\n%r"
message = template % (type(ex).__name__, ex.args)
logger.error(message)
logger.error(traceback.format_exc())
else:
logger.debug("Channel %s not active is not updated" % serie.channel)
# Synchronize the episodes seen from the Kodi video library with that of KoD
try:
if config.is_xbmc(): # If it's Kodi, we do it

View File

@@ -300,10 +300,12 @@ class SearchWindow(xbmcgui.WindowXML):
return channels_list
def timer(self):
while self.searchActions:
while self.searchActions or self.thActions.is_alive():
if self.exit: return
percent = (float(self.count) / len(self.searchActions)) * 100
self.LOADING.setVisible(False)
try:
percent = (float(self.count) / len(self.searchActions)) * 100
except ZeroDivisionError:
percent = 0
self.PROGRESS.setPercent(percent)
self.COUNT.setText('%s/%s [%s"]' % (self.count, len(self.searchActions), int(time.time() - self.time)))
if percent == 100:
@@ -408,6 +410,7 @@ class SearchWindow(xbmcgui.WindowXML):
return it
def update(self, channel, valid, results):
self.LOADING.setVisible(False)
if self.exit:
return
logger.debug('Search on channel', channel)

View File

@@ -285,7 +285,7 @@ def novedades(item):
else:
if mode == 'normal':
logger.debug("Obteniendo novedades de channel_id=" + channel_id)
progreso.update(percentage, "", config.get_localized_string(60520) % channel_title)
progreso.update(percentage, config.get_localized_string(60520) % channel_title)
get_newest(channel_id, item.extra)
# Multi Thread mode: wait for all threads to finish