Fix Metalvideo e Youtube (Necessarie API personali)
This commit is contained in:
@@ -9,37 +9,33 @@ host = 'https://metalvideo.com'
|
|||||||
headers = {'X-Requested-With': 'XMLHttpRequest'}
|
headers = {'X-Requested-With': 'XMLHttpRequest'}
|
||||||
|
|
||||||
|
|
||||||
@support.scrape
|
@support.menu
|
||||||
def mainlist(item):
|
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
|
item.url = host
|
||||||
action = 'peliculas'
|
action = 'peliculas'
|
||||||
patronBlock = r'<ul class="dropdown-menu(?P<block>.*?)</ul>\s*</div'
|
patronBlock = r'<div class="swiper-slide">(?P<block>.*?)<button'
|
||||||
patron = r'<a href="(?P<url>[^"]+)"(?: class="")?>(?P<title>[^<]+)<'
|
patron = r'class="" href="(?P<url>[^"]+)[^>]+>(?P<title>[^<]+)<'
|
||||||
def itemHook(item):
|
def itemHook(item):
|
||||||
item.thumbnail = support.thumb('music')
|
item.thumbnail = support.thumb('music')
|
||||||
item.contentType = 'music'
|
item.contentType = 'music'
|
||||||
return item
|
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()
|
return locals()
|
||||||
|
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
# debug=True
|
# debug=True
|
||||||
action = 'findvideos'
|
action = 'findvideos'
|
||||||
patron= r'<img src="[^"]+" alt="(?P<title>[^"]+)" data-echo="(?P<thumb>[^"]+)"(?:[^>]+>){7}<a href="(?P<url>[^"]+)"'
|
patron= r'<a href="(?P<url>[^"]+)"[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt="(?P<title>[^"]+)"[^>]*>'
|
||||||
patronNext = r'<a href="([^"]+)">(?:»|»)'
|
patronNext = r'<a href="([^"]+)" data-load="[^"]+" class="[^"]+" title="Next'
|
||||||
typeContentDict = {'': 'music'}
|
typeContentDict = {'': 'music'}
|
||||||
def itemHook(item):
|
def itemHook(item):
|
||||||
item.contentType = 'music'
|
item.contentType = 'music'
|
||||||
@@ -54,7 +50,7 @@ def findvideos(item):
|
|||||||
|
|
||||||
def search(item, text):
|
def search(item, text):
|
||||||
support.info(text)
|
support.info(text)
|
||||||
item.url = host + '/search.php?keywords=' + text + '&video-id='
|
item.url = host + '/search?keyword=' + text
|
||||||
try:
|
try:
|
||||||
return peliculas(item)
|
return peliculas(item)
|
||||||
# Continua la ricerca in caso di errore
|
# Continua la ricerca in caso di errore
|
||||||
|
|||||||
@@ -1107,7 +1107,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
# logger.error('Failed to resolve hostname, fallback to normal dns')
|
# logger.error('Failed to resolve hostname, fallback to normal dns')
|
||||||
from core import support
|
from core import support
|
||||||
# support.dbg()
|
# support.dbg()
|
||||||
if '|' not in mediaurl and item.referer != False:
|
if '|' not in mediaurl and item.referer != False and 'youtube' not in mediaurl:
|
||||||
mediaurl = mediaurl + '|' + urllib.urlencode(headers)
|
mediaurl = mediaurl + '|' + urllib.urlencode(headers)
|
||||||
|
|
||||||
# video information is obtained.
|
# video information is obtained.
|
||||||
|
|||||||
@@ -19,44 +19,45 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
import xbmc
|
import xbmc
|
||||||
from xbmcaddon import Addon
|
from xbmcaddon import Addon
|
||||||
logger.debug("(page_url='%s')" % page_url)
|
logger.debug("(page_url='%s')" % page_url)
|
||||||
video_urls = []
|
video_urls = [['Youtube', 'plugin://plugin.video.youtube/play/?video_id='+ page_url.split('=')[-1]]]
|
||||||
|
|
||||||
video_id = scrapertools.find_single_match(page_url, '(?:v=|embed/)([A-z0-9_-]{11})')
|
|
||||||
inputstream = platformtools.install_inputstream()
|
|
||||||
|
|
||||||
try:
|
# video_id = scrapertools.find_single_match(page_url, '(?:v=|embed/)([A-z0-9_-]{11})')
|
||||||
__settings__ = Addon(name)
|
# inputstream = platformtools.install_inputstream()
|
||||||
if inputstream: __settings__.setSetting('kodion.video.quality.mpd', 'true')
|
|
||||||
else: __settings__.setSetting('kodion.video.quality.mpd', 'false')
|
|
||||||
# video_urls = [['con YouTube', 'plugin://plugin.video.youtube/play/?video_id=' + video_id ]]
|
|
||||||
except:
|
|
||||||
path = xbmc.translatePath('special://home/addons/' + name)
|
|
||||||
if filetools.exists(path):
|
|
||||||
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70818)):
|
|
||||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "' + name + '", "enabled": true }}')
|
|
||||||
else: return [['','']]
|
|
||||||
else:
|
|
||||||
xbmc.executebuiltin('InstallAddon(' + name + ')', wait=True)
|
|
||||||
try: Addon(name)
|
|
||||||
except: return [['','']]
|
|
||||||
my_addon = xbmcaddon.Addon('plugin.video.youtube')
|
|
||||||
addon_dir = xbmc.translatePath( my_addon.getAddonInfo('path') )
|
|
||||||
sys.path.append(filetools.join( addon_dir, 'resources', 'lib' ) )
|
|
||||||
|
|
||||||
# load all dependencies for yt addon
|
# try:
|
||||||
dependencies = support.match(filetools.read(filetools.join(addon_dir, 'addon.xml')), patron=r'addon="([^"]+)').matches
|
# __settings__ = Addon(name)
|
||||||
for dep in dependencies:
|
# if inputstream: __settings__.setSetting('kodion.video.quality.mpd', 'true')
|
||||||
sys.path.append(filetools.join(config.get_runtime_path(), '..', dep, 'lib'))
|
# else: __settings__.setSetting('kodion.video.quality.mpd', 'false')
|
||||||
sys.path.append(filetools.join(config.get_runtime_path(), '..', dep, 'resources', 'modules'))
|
# # video_urls = [['con YouTube', 'plugin://plugin.video.youtube/play/?video_id=' + video_id ]]
|
||||||
from youtube_resolver import resolve
|
# except:
|
||||||
try:
|
# path = xbmc.translatePath('special://home/addons/' + name)
|
||||||
for stream in resolve(page_url):
|
# if filetools.exists(path):
|
||||||
# title = scrapertools.find_single_match(stream['title'], '(\d+p)')
|
# if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70818)):
|
||||||
if scrapertools.find_single_match(stream['title'], r'(\d+p)'):
|
# xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "' + name + '", "enabled": true }}')
|
||||||
video_urls.append([re.sub(r'(\[[^\]]+\])', '', stream['title']), stream['url']])
|
# else: return [['','']]
|
||||||
video_urls.sort(key=lambda it: int(it[0].split("p", 1)[0]))
|
# else:
|
||||||
except:
|
# xbmc.executebuiltin('InstallAddon(' + name + ')', wait=True)
|
||||||
pass
|
# try: Addon(name)
|
||||||
|
# except: return [['','']]
|
||||||
|
# my_addon = xbmcaddon.Addon('plugin.video.youtube')
|
||||||
|
# addon_dir = xbmc.translatePath( my_addon.getAddonInfo('path') )
|
||||||
|
# sys.path.append(filetools.join( addon_dir, 'resources', 'lib' ) )
|
||||||
|
|
||||||
|
# # load all dependencies for yt addon
|
||||||
|
# dependencies = support.match(filetools.read(filetools.join(addon_dir, 'addon.xml')), patron=r'addon="([^"]+)').matches
|
||||||
|
# for dep in dependencies:
|
||||||
|
# sys.path.append(filetools.join(config.get_runtime_path(), '..', dep, 'lib'))
|
||||||
|
# sys.path.append(filetools.join(config.get_runtime_path(), '..', dep, 'resources', 'modules'))
|
||||||
|
# from youtube_resolver import resolve
|
||||||
|
# try:
|
||||||
|
# for stream in resolve(page_url):
|
||||||
|
# # title = scrapertools.find_single_match(stream['title'], '(\d+p)')
|
||||||
|
# if scrapertools.find_single_match(stream['title'], r'(\d+p)'):
|
||||||
|
# video_urls.append([re.sub(r'(\[[^\]]+\])', '', stream['title']), stream['url']])
|
||||||
|
# video_urls.sort(key=lambda it: int(it[0].split("p", 1)[0]))
|
||||||
|
# except:
|
||||||
|
# pass
|
||||||
|
|
||||||
return video_urls
|
return video_urls
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user