def nbc_stream(url): if not '&format=redirect' in url: html = Addon.getRequest(url) if 'video src="' in html: url = Addon.find_single_match(html, 'video src="(.+?)"') else: url = Addon.find_single_match(html, 'ref src="(.+?)"') if 'nbcvodenc' in url: html = Addon.getRequest(url) url = Addon.find_single_match(html, 'http(.+?)\n') url = 'http' + url.strip() elif not (url.endswith(".mp4") or url.endswith(".flv")): headers = Addon.defaultHeaders.copy() headers[ 'User-Agent'] = 'Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600X800; rotate)' html = Addon.getRequest(url, headers=headers) urls = Addon.find_multiple_matches(html, 'BANDWIDTH=(.+?),.+?\n(.+?)\n') blast = 0 for b, u in urls: b = int(b) if blast < b: url = u blast = b url += '|User-Agent=' + urllib.quote(headers['User-Agent']) if "Unavailable.mp4" in url: dlg.ok(addonname, "Stream unavailable.") exit() else: Addon.play(url)
def hgtv_episodes(url): req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches(link, '"id" : "(.*?)},') for entry in matches: name = Addon.find_single_match(entry, '"title" : "(.+?)"').replace( "&", "&").replace("'", "'").strip() description = Addon.find_single_match( entry, '"description" : "(.+?)"').replace("<p>", "").replace("<\/p>", "") url = Addon.find_single_match(entry, '"releaseUrl" : "(.+?)"') iconimage = "http://hgtv.com/" + Addon.find_single_match( entry, '"thumbnailUrl" : "(.+?)"') if ".jpg" not in iconimage: iconimage = xbmc.translatePath( os.path.join(plugin_path, 'resources', 'images', 'hgtv_main.png')) if "http" in url: Addon.addLink(name, description, url, 2, iconimage)
def freeform_episodes(url): req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches(link, '<hr />(.*?)<p class="m-t-1">') episodelist = [] for entry in matches: name = Addon.find_single_match( entry, '<h1 class="text-hover">(.+?)</h1>').replace( "&", "&").replace("'", "'").strip() description = Addon.find_single_match( entry, '"ResultDescription":(.+?)"').replace("<p>", "").replace( "<\/p>", "").strip().replace("'", "'").replace(""", '"') url = "http://freeform.go.com" + Addon.find_single_match( entry, '<a href="(.+?)"') iconimage = Addon.find_single_match(entry, '<img src="(.+?)"') lock = Addon.find_single_match( entry, 'data-sign-in-padlock data-requires-sign-in="(.+?)"').strip() if "http" in url and lock == "False": episodelist.append(name) if len(episodelist) > 0: Addon.addLink(name, description, url, 17, iconimage) else: dlg.ok(addonname, "No episodes found.") exit()
def freeform_movies(url): req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches( link, '<div class="movies-grid col-xs-6 col-md-4 col-lg-3">(.*?)</a>') for entry in matches: name = Addon.find_single_match(entry, '<h3 class="m-b-0">(.+?)</h3>').replace( "&", "&").replace("'", "'").strip() description = Addon.find_single_match(entry, '<p>(.+?)</p>').replace( "<p>", "").replace("<\/p>", "").strip().replace("'", "'").replace(""", '"') url = "http://freeform.go.com" + Addon.find_single_match( entry, '<a href="(.+?)"') iconimage = Addon.find_single_match(entry, '<img src="(.+?)"') lock = Addon.find_single_match( entry, 'data-sign-in-padlock data-requires-sign-in="(.+?)"').strip() if "http" in url and lock == "False": Addon.addLink(name, description, url, 17, iconimage)
def hgtv_main(): url = 'http://www.hgtv.com/shows/full-episodes/' req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches( link, '<div class="m-MediaBlock o-Capsule__m-MediaBlock m-MediaBlock--playlist">(.*?)</h4>' ) for entry in matches: name = Addon.find_single_match(entry, 'title="(.+?)"').replace( "&", "&").replace("'", "'").strip() description = "" url = "http:" + Addon.find_single_match(entry, '<a href="(.+?)"') iconimage = "http:" + Addon.find_single_match(entry, 'data-src="(.+?)"') if ".jpg" not in iconimage: iconimage = xbmc.translatePath( os.path.join(plugin_path, 'resources', 'images', 'hgtv_main.png')) videos = Addon.find_single_match( entry, '<span class="m-MediaBlock__a-AssetInfo">(.+?) Videos</span>') if videos != "0": Addon.addDir(name, description, url, 1, iconimage)
def smith_main(): url = 'http://www.smithsonianchannel.com/full-episodes' req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches( link, '<li class="mix free" data-premium="false">(.*?)</li>') for entry in matches: name = Addon.find_single_match( entry, '<h3 class="promo-series-name">(.+?)</h3>').replace( "&", "&").replace("'", "'") description = Addon.find_single_match( entry, '<h2 class="promo-show-name">(.+?)</h2>').replace( "&", "&").replace("'", "'") url = "http://www.smithsonianchannel.com/" + Addon.find_single_match( entry, '<a href="(.+?)"') iconimage = "http:" + Addon.find_single_match( entry, '<source srcset="(.+?)"') if len(name) > 0 and "http" in url: Addon.addLink(name, description, url, 11, iconimage)
def abc_seasons(url, iconimage): req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches(link, '<option(.*?)option>') if matches == []: abc_episodes(url) else: seasonlist = [] for entry in matches: name = Addon.find_single_match(entry, '>(.+?)</').replace( "&", "&").replace("'", "'").strip() description = "" path = Addon.find_single_match(entry, 'value="(.+?)"').replace( "/index", "") url = "http://abc.go.com" + path if len(path) > 0: seasonlist.append(path) if len(seasonlist) > 0: Addon.addDir(name, description, url, 20, iconimage) else: dlg.ok(addonname, "No episodes found.") exit()
def abc_main(): url = 'http://abc.go.com/shows' req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches(link, '<li data-sm-id=""(.*?)/li>') for entry in matches: name = Addon.find_single_match( entry, '<div class="tile-show-name truncate">(.+?)</div>').replace( "&", "&").replace("'", "'") description = "" path = Addon.find_single_match(entry, '<a href="(.+?)"').replace( "/index", "") if name == "The Neighbors": url = "http://abc.go.com" + path + "/episode-guide/season-01" else: url = "http://abc.go.com" + path + "/episode-guide" iconimage = Addon.find_single_match(entry, 'srcset="(.+?) ') if "http" in url and name != "": Addon.addDir(name, description, url, 19, iconimage)
def cooking_main(): url = 'http://www.cookingchanneltv.com/videos/players/full-episodes-player' req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches(link, '<html >(.*?)</html>') for entry in matches: name = Addon.find_single_match( entry, '<span class="m-VideoPlayer__a-HeadlineText">(.+?)</span>' ).replace("&", "&").replace("'", "'") description = "" url = "null" iconimage = "http://cookingchanneltv.com/" + Addon.find_single_match( entry, '"thumbnailUrl" : "(.+?)"') if ".jpg" not in iconimage: iconimage = xbmc.translatePath( os.path.join(plugin_path, 'resources', 'images', 'cooking_main.png')) if name is not "": Addon.addDir(name, description, url, 7, iconimage) matches = Addon.find_multiple_matches( link, 'data-module="editorial-promo">(.*?)</div>') for entry in matches: name = Addon.find_single_match(entry, 'title="(.+?)"').replace( "&", "&").replace("'", "'") description = "" url = "http:" + Addon.find_single_match(entry, '<a href="(.+?)"') iconimage = "http:" + Addon.find_single_match(entry, 'data-src="(.+?)"') if ".jpg" not in iconimage: iconimage = xbmc.translatePath( os.path.join(plugin_path, 'resources', 'images', 'cooking_main.png')) if name is not "": Addon.addDir(name, description, url, 7, iconimage)
def abc_episodes(url): req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches( link, '<div class="m-episode-copy medium-8 large-6 columns nogutter ">(.*?)</picture>' ) if len(matches) > 0: episodelist = [] for entry in matches: season = Addon.find_single_match( entry, '<span class="season-number light">(.+?)</span>').replace( "&", "&").replace("'", "'").strip() season = re.sub('<[^<]+?>', '', season).strip() episode = Addon.find_single_match( entry, '<span class="episode-number">(.+?)</a>').replace( "&", "&").replace("'", "'").strip() episode = re.sub('<[^<]+?>', '', episode).strip() name = season + " " + episode description = Addon.find_single_match( entry, '<p>(.+?)</p>').replace("&", "&").replace("'", "'").strip() description = re.sub('<[^<]+?>', '', description).strip() path = Addon.find_single_match( entry, '<a class="dark-text" href="(.+?)">Watch</a>') url = "http://abc.go.com" + path iconimage = Addon.find_single_match(entry, 'srcset="(.+?) ') if len(path) > 0: episodelist.append(path) if len(episodelist) > 0: Addon.addLink(name, description, url, 21, iconimage) else: dlg.ok(addonname, "No episodes found.") exit() else: dlg.ok(addonname, "No episodes found.") exit()
def freeform_main(): url = 'http://freeform.go.com/shows' req = urllib2.Request(url) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req) link = response.read() response.close() matches = Addon.find_multiple_matches( link, '<div class="col-xs-4 shows-grid">(.*?)/p>') for entry in matches: name = Addon.find_single_match(entry, '<h3>(.+?)</h3>').replace( "&", "&").replace("'", "'") description = Addon.find_single_match(entry, '<p>(.+?)<').replace( "&", "&").replace("'", "'") url = "http://freeform.go.com" + Addon.find_single_match( entry, '<a href="(.+?)"') iconimage = Addon.find_single_match(entry, '<img src="(.+?)"') if "http" in url: Addon.addDir(name, description, url, 16, iconimage)