def select_episode(data, url): sindex = None eindex = None tr_value = None data_, tr_value = select_translator(data, url) season, sindex = select_season(data_) if season == "": return "", sindex, eindex VALUES["t"] = tr_value VALUES["s"] = season VALUES["e"] = "1" data_ = tools.get_response(url, HEADERS, VALUES, "GET") data_ = common.parseDOM(data, "div", attrs={"id": "tabs"})[0] select = common.parseDOM(data, "select", attrs={"id": "episodes"})[0] episodes = common.parseDOM(select, "option") values = common.parseDOM(select, "option", ret="value") if len(episodes) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select episode", episodes) if int(index_) < 0: index_ = 0 else: index_ = 0 episode = values[index_] eindex = str(int(episodes[index_].split(" ")[0])) VALUES["t"] = tr_value VALUES["s"] = season VALUES["e"] = episode response = tools.get_response(url, HEADERS, VALUES, "GET") return response, season, episode
def get_playlist(url): manifest_links = {} subtitles = None season = None episode = None try: response = tools.get_response(url, HEADERS, {}, "GET") except: return manifest_links, subtitles, season, episode #tvshow tvshow = response.split("season:")[1].split(",")[0].replace(" ", "") if (tvshow != "null"): response, season, episode = select_episode(response, url) if response == "": return manifest_links, subtitles, season, episode part = response.split("hls_master_file_path: '")[-1].split("',")[0] url_ = "https://gethdhls.com" + part try: response = tools.get_response(url_, HEADERS2, {}, "GET") except: return manifest_links, subtitles, season, episode urls = re.compile("https:\/\/.*?\.m3u8").findall(response) for i, url in enumerate(urls): manifest_links[QUALITY_TYPES[i]] = url return manifest_links, subtitles, season, episode
def select_episode(data, url): url_ = url sindex = None eindex = None data, url = select_translator(data, url) surl, season, sindex = select_season(data) if season == "": return "", sindex, eindex try: response = tools.get_response(surl, HEADERS, {}, "GET") except: return "", sindex, eindex tvshow = common.parseDOM(response, "div", attrs={"class": "bar-button"})[1] series = common.parseDOM(tvshow, "a") evalues = common.parseDOM(tvshow, "a", ret="href") if len(series) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select episode", series) if int(index_) < 0: index_ = -1 else: index_ = 0 episode = str(index_+1) eindex = str(index_+1) if index_ < 0: return "", sindex, eindex try: response = tools.get_response("https://" + PLAYLIST_DOMAIN + evalues[index_], HEADERS, {}, "GET") return response, sindex, eindex except: return "", sindex, eindex
def select_episode(franchise, url): sindex = None eindex = None ids, sindex = select_season(franchise, url) if not ids: return "", sindex, eindex url_ = "https://" + url.split("//")[-1].split("/")[0] + ( "/contents/video/by-season/?id=%s&host=zombie-film.com-embed" % ids) try: response = tools.get_response(url_, HEADERS, {}, "GET") except: return None, None json_data = json.loads(response) episodes = [] values = [] urls = [] for episode in json_data: episodes.append(episode["name"]) values.append(episode["episode"]) urls.append(episode["urlQuality"]) if len(episode) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select episode", episodes) if int(index_) < 0: index_ = -1 else: index_ = 0 if index_ < 0: return "", None, None else: return str(urls[index_]), sindex, values[index_]
def select_season(franchise, url): url_ = "https://" + url.split("//")[-1].split("/")[0] + ( "/contents/season/by-franchise/?id=%s&host=zombie-film.com-embed" % franchise) try: response = tools.get_response(url_, HEADERS, {}, "GET") except: return None, None json_data = json.loads(response) seasons = [] values = [] for season in json_data: seasons.append(str(season["season"])) values.append(season["id"]) if len(seasons) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select season", seasons) if int(index_) < 0: index_ = -1 else: index_ = 0 if index_ < 0: return None, None else: return values[index_], seasons[index_]
def get_playlist(url): manifest_links = {} subtitles = None season = None episode = None hlsList = [] try: response = tools.get_response(url, HEADERS, {}, "GET") except: return manifest_links, subtitles, season, episode #{u'720': u'https://hls-t001-l001-c008-s001.videobalancer.net:15000/06_19_18/06/19/04/L2QPEz3U/1080_eRZe0ykM.mp4/tracks/v1-a/master.m3u8', u'480': u'https://hls-t001-l001-c008-s001.videobalancer.net:15000/06_19_18/06/19/04/L2QPEz3U/1080_eRZe0ykM.mp4/tracks/v2-a/master.m3u8'} if "episode:" in response: franchise = response.split("franchise:")[-1].split(",")[0].replace( " ", "") data, season, episode = select_episode(franchise, url) if episode: hlsList = data.replace("{", "").replace("}", "").replace( "u'", "").replace("':", '":"').split(",") else: hlsList = response.split("hlsList: {")[-1].split("}")[0].split(",") for item in hlsList: quality = int(item.split('":"')[0].replace('"', "")) url_ = item.split('":"')[1].replace('"', "").replace("'", "").replace(" ", "") manifest_links[quality] = url_ return manifest_links, subtitles, season, episode
def get_content(): vh_title = "yohoho." list_li = [] VALUES["kinopoisk"] = _kp_id_ response = tools.get_response(URL, HEADERS, VALUES, 'POST') if response: jdata = json.loads(response) for host in ENABLED_HOSTS: host_data = jdata[host] if host_data: iframe = host_data["iframe"] translate = host_data["translate"] quality = host_data["quality"] #{"vodlocker":{}, # "hdgo":{"iframe":"https://hdgo.cx/video/oSlSCtQ0t8apv6vJGD1va2xbKTd9k8YC/17223/","translate":"Дублированный","quality":"плохое TS"}, # "iframe":{"iframe":"https://videoframe.at/movie/2eb6408pc8p/iframe","translate":"Полное дублирование","quality":"TS"}, # "torrent":{"iframe":"https://4h0y.yohoho.cc/?title=%D1%85%D0%B8%D1%89%D0%BD%D0%B8%D0%BA"}, # "hdbaza":{"iframe":"https://vidozzz.com/iframe?mh=bbd8ed61c2256ea4&uh=65bd8ef1126daa6f","translate":"Viruseproject","quality":""}, # "kodik":{"iframe":"https://kodik.cc/video/15298/6f7fcc06b4e7d51f4ff574af5a59115e/720p","translate":"Проф. Многоголосый","quality":"BDRip 720p"}, # "trailer":{"iframe":"https://hdgo.cx/video/trailer/oSlSCtQ0t8apv6vJGD1va2xbKTd9k8YC/17223/"}, # "moonwalk":{"iframe":"https://streamguard.cc/video/d9419273b3fea0ef15980f70e35cc078/iframe?show_translations=1","translate":"Дубляж","quality":""}} title_ = "*T*" title = "[COLOR=orange][{0}][/COLOR] {1} ({2})".format( vh_title + host, tools.encode(title_), translate + "," + quality) uri = sys.argv[0] + "?mode=show&url={0}".format( urllib.quote_plus(prepare_url(host, iframe))) item = xbmcgui.ListItem(title) list_li.append([uri, item, True]) return list_li
def select_translator(data, url): tr_arr = data.split("sounds: [")[-1].split("seasons")[0].replace( "\n", "").replace(" ", "").split("],[") translators = [] tr_values = [] for tr_item in tr_arr: translators.append( tr_item.split(",")[1].replace("'", "").replace("]", "")) tr_values.append( tr_item.split(",")[0].replace("'", "").replace("[", "")) if len(translators) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select translator", translators) if int(index_) < 0: index_ = 0 else: index_ = 0 tr_value = tr_values[index_] VALUES["snd"] = tr_value VALUES["s"] = "1" VALUES["e"] = "1" response = tools.get_response(url, HEADERS, VALUES, "GET") return response, tr_value
def select_translator(content, url): try: tr_div = common.parseDOM(content, 'div', attrs={"class": "bar-button pull-right"})[0] except: return content, url translators_ = common.parseDOM(tr_div, 'a') translators = common.parseDOM(translators_, 'span') tr_values = common.parseDOM(tr_div, 'a', ret="href") if len(translators) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select translator", translators) if int(index_) < 0: index_ = 0 else: index_ = 0 try: tr_value = "https://" + PLAYLIST_DOMAIN + tr_values[index_] response = tools.get_response(tr_value, HEADERS, {}, "GET") except: return content, url return response, tr_value
def get_playlist(url): manifest_links = {} subtitles = None season = None episode = None try: response = tools.get_response(url if "http" in url else "https:" + url, HEADERS, {}, "GET") except: return manifest_links, subtitles, season, episode tr_value = select_translator(response) links_ = replace_( common.parseDOM(response, "input", attrs={"id": "files"}, ret="value")[0]) links = json.loads(links_) #tvshow videoType = common.parseDOM(response, "input", attrs={"id": "videoType"}, ret="value")[0] if (videoType == "tv_series"): links_tr, season, episode = select_episode(links, tr_value) else: links_tr = links[tr_value].split(',')[-1].split(" or ") for link in links_tr: if (not ("p]" in link)): manifest_links[link.split("/")[-1].split(".")[0]] = link return manifest_links, subtitles, season, episode
def prepare_url(url): if not url: return "" response = tools.get_response(url, HEADERS2, {}, 'GET') if response: return "http:" + common.parseDOM(response, "iframe", ret="src")[0] else: return url
def select_episode(data, url): sindex = None eindex = None data_, tr_value = select_translator(data, url) season, sindex = select_season(data_, tr_value) if season == "": return "", sindex, eindex VALUES["snd"] = tr_value VALUES["s"] = season VALUES["e"] = "1" try: response = tools.get_response(url, HEADERS, VALUES, "GET") except: return "", sindex, eindex sss = response.split("soundsList: ")[-1].split( "selected_options:")[0].replace(' ', '').replace("\n", '').replace( "],}", "]}").replace("},}", "}}").replace("'", '"') seriesjson = json.loads(sss[:len(sss) - 1]) series = [] for episode in seriesjson[tr_value][season]: series.append(str(episode)) evalues = series if len(series) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select episode", series) if int(index_) < 0: index_ = -1 else: index_ = 0 episode = str(index_ + 1) eindex = str(index_ + 1) if index_ < 0: return "", sindex, eindex VALUES["snd"] = tr_value VALUES["s"] = season VALUES["e"] = episode try: response = tools.get_response(url, HEADERS, VALUES, "GET") return response, sindex, eindex except: return "", sindex, eindex
def fetch_spacex_last_launch() -> List: url = 'https://api.spacexdata.com/v3/launches/' launches = get_response(url).json()[::-1] for launch in launches: images = launch.get("links").get("flickr_images") if images: break return images
def get_playlist(url): manifest_links = {} subtitles = None season = None episode = None try: response = tools.get_response(url, HEADERS, {}, "GET") except: return manifest_links, subtitles, season, episode data = common.parseDOM(response, "div", attrs={"id": "nativeplayer"}, ret="data-config")[0] jdata = json.loads(data) type_content = jdata["type"] #tvshow if (type_content == "serial"): response, season, episode = select_episode(response, url) if response == "": return manifest_links, subtitles, season, episode data = common.parseDOM(response, "div", attrs={"id": "nativeplayer"}, ret="data-config")[0] jdata = json.loads(data) url_ = "https:" + jdata["hls"].replace("\/", "/") try: response = tools.get_response(url_, HEADERS, {}, "GET") except: return manifest_links, subtitles, season, episode #EXTM3U\n#EXT-X-STREAM-INF:BANDWIDTH=400000,RESOLUTION=640x358\n./360/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=800000,RESOLUTION=858x482\n./480/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=2000000,RESOLUTION=1280x718\n./720/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=3000000,RESOLUTION=1920x1080\n./1080/index.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=12000000,RESOLUTION=3840x2160\n./2160/index.m3u8\n block = url_.replace("index.m3u8", "") urls = re.compile("\.\/.*?\n").findall(response) for url in urls: manifest_links[int(url.split("/")[1])] = block + url.replace( "./", "").replace("\n", "") return manifest_links, subtitles, season, episode
def prepare_url(url): if not url: return "" HEADERS2["Referer"] = url response = tools.get_response(url, HEADERS2, {}, 'GET') if response: return common.parseDOM(response, "iframe", ret="src")[0] else: return url
def select_episode(data, url): data_, url_ = select_translator(data, url) url_ = url_.split('?')[0] sindex = None eindex = None season, sindex = select_season(data_) if season == "": return "", sindex, eindex headers = { "Referer": url, "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" } values = { "season": season, "episode": "1" } response = tools.get_response(url_, headers, values, "GET") series = [] series_ = response.split("episodes: [")[-1].split("],")[0].split(",") for seria in series_: series.append(seria) if len(series) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select episode", series) if int(index_) < 0: return "", sindex, eindex else: index_ = 0 episode = series[index_] eindex = str(index_ + 1) if episode < 0: return "", season, episode values = { "season": season, "episode": episode } try: return tools.get_response(url_, headers, values, "GET"), season, episode except: return "", season, episode
def get_collection_ids(collection) -> List: payload = {"page": "all", "collection_name": collection} url = 'http://hubblesite.org/api/v3/images' content = get_response(url, payload).json() ids = [] for hub in content: id_ = hub.get('id') if id_: ids.append(str(id_)) return ids
def prepare_url(host, url): if not url: return "" if host != "hdgo": return url response = tools.get_response(url, HEADERS2, {}, 'GET') if response: return common.parseDOM(response, "iframe", ret="src")[0] else: return url
def fetch_hubble_urls(collection='spacecraft'): collection_ids = get_collection_ids(collection) base_url = "http://hubblesite.org/api/v3/image/" dl_url = "https://hubblesite.org/uploads/image_file/image_attachment" collection_urls = [] for elem in collection_ids: url = base_url + elem files = get_response(url).json() dl = files.get("image_files")[-1].get('file_url') dl = "/".join(dl.split("/")[-2:]) pic_url = dl_url + '/' + dl collection_urls.append(pic_url) return collection_urls
def get_content(): vh_title = "czx.to" list_li = [] response = tools.get_response(URL + '/' + str(_kp_id_) + '/', HEADERS, VALUES, 'GET') if response: iframe = common.parseDOM(response, "iframe", ret="src")[0] title_ = "*T*" title = "[COLOR=orange][{0}][/COLOR] {1}".format( vh_title, tools.encode(title_)) uri = sys.argv[0] + "?mode=show&url={0}".format( urllib.quote_plus(iframe)) item = xbmcgui.ListItem(title) list_li.append([uri, item, True]) return list_li
def select_translator(data, url): data = common.parseDOM(data, "div", attrs={"id": "tabs"})[0] select = common.parseDOM(data, "select", attrs={"id": "translation"})[0] translators = common.parseDOM(select, "option") tr_values = common.parseDOM(select, "option", ret="value") if len(translators) > 1: dialog = xbmcgui.Dialog() index_ = dialog.select("Select translator", translators) if int(index_) < 0: index_ = 0 else: index_ = 0 tr_value = tr_values[index_] VALUES["t"] = tr_value VALUES["s"] = "1" VALUES["e"] = "1" response = tools.get_response(url, HEADERS, VALUES, "GET") return response, tr_value
def get_content(part): vh_title = "kodik.top" list_li = [] VALUES["search"] = _kp_id_ HEADERS["Referer"] = URL + part response = tools.get_response(URL + part, HEADERS, VALUES, 'POST') if response: try: table = common.parseDOM(response, "table", attrs={"class": "table table-hover"}) tbody = common.parseDOM(table, "tbody") rows = common.parseDOM(tbody, "tr") for item in rows: try: tds = common.parseDOM(item, "td") url_ = "https:" + common.parseDOM( item, "a", attrs={"class": "btn btn-success btn-xs copypreview"}, ret="data-link")[0] except: continue url = prepare_url(url_) title_ = tools.strip(tds[0]) + " (" + tools.strip( tds[1]) + ", " + tools.strip(tds[2]) + ")" title = "[COLOR=orange][{0}][/COLOR] {1}".format( vh_title, tools.encode(title_)) uri = sys.argv[0] + "?mode=show&url={0}&title={1}".format( urllib.quote_plus(url), urllib.quote_plus(title)) item = xbmcgui.ListItem(title) list_li.append([uri, item, True]) except: pass return list_li
def get_playlist(url): manifest_links = {} subtitles = None season = None episode = None try: response = tools.get_response(url, HEADERS, {}, "GET") except: return manifest_links, subtitles, season, episode data_type = common.parseDOM(response, "div", attrs={"id": "videoframe"}, ret="data-type")[0] #tvshow if (data_type == "serial"): response, season, episode = select_episode(response, url) if response == "": return manifest_links, subtitles, season, episode data_token = common.parseDOM(response, "div", attrs={"id": "videoframe"}, ret="data-token")[0] url_ = "https://" + PLAYLIST_DOMAIN + "/loadvideo" VALUES["token"] = data_token VALUES["type"] = data_type try: response = tools.get_response(url_, HEADERS2, VALUES, "POST") except: return manifest_links, subtitles, season, episode jdata = json.loads(response) try: v_id = jdata["show"]["youtube"]["videoId"] link = 'plugin://plugin.video.youtube/play/?video_id=' + v_id manifest_links["ad"] = link return manifest_links, subtitles, season, episode except: pass try: url_ = jdata["show"]["links"]["url"] except: return manifest_links, subtitles, season, episode try: response = tools.get_response(url_, HEADERS3, {}, "GET") except urllib2.HTTPError, error: url_ = dict(error.info())['location'] headers = { "Host": url_.split("//")[-1].split("/")[0], "Origin": "null", "Referer": "https://" + PLAYLIST_DOMAIN + "/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" } response = tools.get_response(url_, headers, {}, "GET")