def stream(url, title, thumbnail): path = url li = xbmcgui.ListItem(label=title, iconImage=thumbnail, thumbnailImage=thumbnail, path=path) li.setInfo(type='Video', infoLabels={"Title": str(title)}) li.setSubtitles([plugintools.get_temp_path()+'s.srt']) xbmc.Player().play(path, li)
def get_subtitle(url): dest = plugintools.get_temp_path() + 'ws.srt' # dest = 'ss.srt' starurl = url[:url.find('playlist')] res = requests.get(url) # print res.content ############### find sub im m3u8 sub = re.compile('(subtitle.*?),').findall(res.text) if sub: sub_url = starurl + sub[0] # print sub_url res = requests.get(sub_url) # print res.content ############## Find all sub url in suburl ######### allsub = re.compile('(n.*?webvtt.*?)\n').findall(res.text) # print allsub for i, j in enumerate(allsub): s_sul = starurl + j # print i if i == 0: ############ start open write mode fi = open(dest, "w+") # print sub_url else: ##### another open append mode fi = open(dest, "a") fi.write(read(s_sul)) fi.close() else: # print 'No sub' fi = open(dest, "w") fi.write('') fi.close()
def download_subtitle(url): dest = plugintools.get_temp_path() + 's.srt' fi = open(dest, "w") fi.write(plugintools.read(url)) fi.close()
def del_sub(): try: os.remove(plugintools.get_temp_path() + 's.srt') except OSError: None
# -*- coding: utf-8 -*- import json, plugintools import os import requests import sys import xbmcgui from bs4 import BeautifulSoup from base64 import b64decode tmplastpath = plugintools.get_temp_path() + "\info_.json" baseurl = b64decode('aHR0cHM6Ly93d3cudml1LmNvbS9vdHQvdGgvaW5kZXgucGhw') srbaseurl = b64decode( 'aHR0cHM6Ly93d3cudml1LmNvbS9vdHQvdGgvaW5kZXgucGhwP3I9dm9kL2FqYXgtZGV0YWlsJnBsYXRmb3JtX2ZsYWdfbGFiZWw9d2ViJmFyZWFfaWQ9NCZsYW5ndWFnZV9mbGFnX2lkPTQmcHJvZHVjdF9pZD0=' ) fbaseurl = b64decode( 'aHR0cHM6Ly9kZnA2cmdsZ2pxc3prLmNsb3VkZnJvbnQubmV0L2luZGV4LnBocD9yPXYxL3NlYXJjaC92aWRlbyZsYW5ndWFnZV9mbGFnX2lkPTQ=' ) stmbaseurl = b64decode( 'aHR0cHM6Ly9kMWsydXM2NzFxY29hdS5jbG91ZGZyb250Lm5ldC9kaXN0cmlidXRlX3dlYl90aC5waHA/Y2NzX3Byb2R1Y3RfaWQ9' ) caturl = baseurl + '?r=category/series-category&platform_flag_label=web&area_id=4&language_flag_id=4&' def getgenre(): r = requests.get(b64decode('aHR0cHM6Ly93d3cudml1LmNvbS9vdHQvdGgv')) r.encoding = "utf-8" soup = BeautifulSoup(r.text, 'html5lib') soup.prettify() ul = soup.find('ul', {'class': "v-nav"}) li = ul.findAll('a', {'class': ''}) seriesList = [] # print (li)