Files
addon/channels/hd4me.py
Alhaziel01 17e0de9f8b Fix HD4ME
2020-07-09 12:07:54 +02:00

61 lines
1.8 KiB
Python

# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Canale per HD4ME
# ------------------------------------------------------------
from core import support
host = support.config.get_channel_url()
headers = [['Referer', host]]
@support.menu
def mainlist(item):
film = [('Genere', ['', 'genre'])]
return locals()
@support.scrape
def peliculas(item):
# debug = True
if item.args == 'alternative':
patron = r'<a title="(?P<title>[^\(]+)\(\s*(?P<year>\d+)\)\s\D+(?P<quality>\d+p) ... (?P<lang>[^ ]+).*?[^"]+"\s*href="(?P<url>[^"]+)'
else:
patron = r'<a href="(?P<url>[^"]+)" rel="?[0-9]+"? title="(?P<title>[^\(]+)(?!\()\s*\((?P<year>\d+)\)\s\D+(?P<quality>\d+p).{3}(?P<lang>[^ ]+).*?<img id="?cov"?.*?src="(?P<thumb>[^"]+)'
patronNext = r'rel="?next"? href="([^"]+)"'
return locals()
@support.scrape
def genre(item):
action = 'peliculas'
blacklist =['prova ']
patronMenu = r'<a href="(?P<url>[^"]+)" class="menu-link\s*sub-menu-link">(?P<title>[^<]+)<'
def itemHook(item):
if item.fulltitle in ['Classici Disney', 'Studio Ghibli', 'Pixar']:
item.args = 'alternative'
return item
return locals()
def search(item, text):
support.log(text)
item.url = host + '/?s=' + text
try:
return peliculas(item)
# Cattura la eccezione così non interrompe la ricerca globle se il canale si rompe!
except:
import sys
for line in sys.exc_info():
support.logger.error("search except: %s" % line)
return []
def findvideos(item):
url = support.match(item, patron=r'<a class=["]?bot1["]? href="([^"]+)"').match
url = support.httptools.downloadpage(url, followredirect=True).url
return support.server(item, url)