def PLAY_URL(name,url,iconimage): name,url = url.split('|SPLIT|') dp = common.GET_LUCKY() ref_url = url result = common.open_url(url) url = re.compile("video_url:.+?'(.+?)',",re.DOTALL).findall(result)[0] choice = dialog.select("[COLOR red]Please select an option[/COLOR]", ['[COLOR pink]Watch Video[/COLOR]','[COLOR pink]Add to Favourites[/COLOR]','[COLOR pink]Download Video[/COLOR]']) if choice == 1: a=open(FAVOURITES_FILE).read() b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>PornFun</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n') f= open(FAVOURITES_FILE, mode='w') f.write(str(b)) f.close() dp.close() dialog.ok(AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]") quit() elif choice == 2: try: download_location = plugintools.get_setting("download_location") download_folder = xbmc.translatePath(download_location) _in = url name = name.replace(' ','_').replace('[COLOR','').replace('[/COLOR','').replace('[I]','').replace(']','').replace('|','').replace('%','').replace('-','').replace('[/I','').replace('[/B','').replace('[','').replace('/','').replace(':','') _out = download_folder + name + '.mp4' dp.close() a=open(DOWNLOADS_FILE).read() b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(_out)+'</name>\n<icon>'+str(iconimage)+'</icon>\n</item>\n') f= open(DOWNLOADS_FILE, mode='w') f.write(str(b)) f.close() downloader.download(_in,_out,dp=None) dialog.ok(AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]") except: try: os.remove(_out) except: pass dp.close() dialog.ok(AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]") quit() elif choice == 0: history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a=open(HISTORY_FILE).read() b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<date>'+str(date_now)+'</date>\n<time>'+str(time_now)+'</time>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>PornFun</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n') f= open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) dp.close() xbmc.Player ().play(url, liz, False) else: dp.close() quit()
def PLAY_URL(name, url, iconimage): dp = common.GET_LUCKY() name, url, iconimage = url.split('|SPLIT|') orig_url = "http://www.chaturbate.com" + url result = common.open_url(orig_url) match = re.compile('<head>(.+?)</html>', re.DOTALL).findall(result) string = str(match).replace('\\', '').replace('(', '').replace(')', '') url = "null" try: url = re.compile("src='([^']+)'").findall(string)[0] except: dialog.ok(AddonTitle, "Sorry, we are unable to find a playable link.") quit() url2 = url + '|Referer=' + orig_url dp.close() history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a = open(HISTORY_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' + str(date_now) + '</date>\n<time>' + str(time_now) + '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url2) + '</link>\n<site>Chaturbate</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) xbmc.Player().play(url2, liz, False)
def PLAY_URL(name, url, iconimage): dp = common.GET_LUCKY() name, url, iconimage = url.split('|SPLIT|') orig_url = "http://www.chaturbate.com" + url result = common.open_url(orig_url) match = re.compile('<head>(.+?)</html>', re.DOTALL).findall(result) string = str(match).replace('\\', '').replace('(', '').replace(')', '') url = "null" try: url_fast = re.compile("hlsSourceFast = '(.+?)';").findall(string)[0] except: url_fast == "null" try: url_slow = re.compile("hlsSourceSlow = '(.+?)';").findall(string)[0] except: url_slow == "null" if not "http" in url_fast: url = url_slow if not "http" in url_slow: url = url_fast if url == "null": choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [ '[COLOR pink]Watch Fast Stream[/COLOR]', '[COLOR pink]Watch Slow Stream[/COLOR]' ]) if choice == 0: url = url_fast elif choice == 1: url = url_slow else: quit() if os.path.exists(F4M): url2 = 'plugin://plugin.video.f4mTester/?streamtype=HLSRETRY&name=' + name + '&url=' + url + '&iconImage=' + iconimage else: url2 = url + '|Referer=' + orig_url dp.close() history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a = open(HISTORY_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' + str(date_now) + '</date>\n<time>' + str(time_now) + '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url2) + '</link>\n<site>Chaturbate</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) xbmc.Player().play(url2, liz, False)
def PLAY_URL(name, url, iconimage): name, url, iconimage = url.split('|SPLIT|') name = name.replace('[COLOR white]', '').replace('[/COLOR]', '').replace(' - ', '') ref_url = url dp = common.GET_LUCKY() try: result = common.open_url(url).replace('/n', '') except: dialog.ok(AddonTitle, "Error connecting to website. Please try again.") quit() url = re.compile("\'file\'.+?\'(.+?)\',").findall(result)[0] url = url.replace("['", '').replace("']", '').replace( '%3A%2F%2F', '://').replace('%2F', '/').replace('amp;', '') choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [ '[COLOR pink]Watch Video[/COLOR]', '[COLOR pink]Add to Favourites[/COLOR]', '[COLOR pink]Download Video[/COLOR]' ]) if choice == 1: a = open(FAVOURITES_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>XNGX</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(FAVOURITES_FILE, mode='w') f.write(str(b)) f.close() dp.close() dialog.ok( AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]" ) quit() elif choice == 2: try: download_location = plugintools.get_setting("download_location") download_folder = xbmc.translatePath(download_location) _in = url name = name.replace(' ', '_').replace('[COLOR', '').replace( '[/COLOR', '').replace('[I]', '').replace(']', '').replace( '|', '').replace('%', '').replace('-', '').replace( '[/I', '').replace('[/B', '').replace('[', '').replace( '/', '').replace(':', '') _out = download_folder + name + '.mp4' dp.close() a = open(DOWNLOADS_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(_out) + '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(DOWNLOADS_FILE, mode='w') f.write(str(b)) f.close() downloader.download(_in, _out, dp=None) dialog.ok( AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]" ) except: try: os.remove(_out) except: pass dp.close() dialog.ok( AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]" ) quit() elif choice == 0: history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a = open(HISTORY_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' + str(date_now) + '</date>\n<time>' + str(time_now) + '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>NXGX</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36' liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) dp.close() xbmc.Player().play(url, liz, False) quit() else: dp.close() quit()
def PLAY_URL(name, url, iconimage): name, url = url.split('|SPLIT|') dp = common.GET_LUCKY() choice = dialog.select( "[COLOR red]Please select an option[/COLOR]", ['[COLOR pink]Source 1[/COLOR]', '[COLOR pink]Source 2[/COLOR]']) if choice == 0: url = url elif choice == 1: url = url + '2/' else: quit() ref_url = url urlresolve = 0 headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36' } holdingpage = net.http_GET(url, headers).content if "openload" in holdingpage: match = re.compile('src="https://openload.co/(.+?)"').findall( holdingpage)[0] url = "https://openload.co/" + match import urlresolver if urlresolver.HostedMediaFile(url).valid_url(): urlresolve = 1 else: net.save_cookies(TEMP_COOKIES) try: match = re.compile('src="http://www.porn00.org/king/(.+?)"' ).findall(holdingpage)[0] id = 'king' except: try: match = re.compile('http://www.porn00.org/server/(.+?)"' ).findall(holdingpage)[0] id = 'server' except: try: match = re.compile('http://www.porn00.org/play/(.+?)"' ).findall(holdingpage)[0] id = 'play' except: try: match = re.compile( 'http://www.porn00.org/player/(.+?)"').findall( holdingpage)[0] id = 'player' except: try: id, match = re.compile( 'http://www.porn00.org/(.+?)/(.+?)"').findall( holdingpage)[0] except: quit() url = 'http://www.porn00.org/' + id + '/' + match net.set_cookies(TEMP_COOKIES) linkpage = net.http_GET(url, headers).content links = re.compile('file\: "(.+?)",').findall(linkpage) try: url = links[-1] except: try: url = links[0] except: dialog.ok( AddonTitle, "There was an error playing this video. Please select another." ) quit() choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [ '[COLOR pink]Watch Video[/COLOR]', '[COLOR pink]Add to Favourites[/COLOR]', '[COLOR pink]Download Video[/COLOR]' ]) if choice == 1: a = open(FAVOURITES_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>Porn00</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(FAVOURITES_FILE, mode='w') f.write(str(b)) f.close() dp.close() dialog.ok( AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]" ) quit() elif choice == 2: try: download_location = plugintools.get_setting("download_location") download_folder = xbmc.translatePath(download_location) _in = url name = name.replace(' ', '_').replace('[COLOR', '').replace( '[/COLOR', '').replace('[I]', '').replace(']', '').replace( '|', '').replace('%', '').replace('-', '').replace( '[/I', '').replace('[/B', '').replace('[', '').replace( '/', '').replace(':', '') _out = download_folder + name + '.mp4' dp.close() a = open(DOWNLOADS_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(_out) + '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(DOWNLOADS_FILE, mode='w') f.write(str(b)) f.close() downloader.download(_in, _out, dp=None) dialog.ok( AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]" ) except: try: os.remove(_out) except: pass dp.close() dialog.ok( AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]" ) quit() elif choice == 0: history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a = open(HISTORY_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' + str(date_now) + '</date>\n<time>' + str(time_now) + '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>Porn00</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() if urlresolve == 1: url = urlresolver.HostedMediaFile(url).resolve() else: url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.220203.207 Safari/537.36&Referer=' + ref_url liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) dp.close() xbmc.Player().play(url, liz, False) else: dp.close() quit()
def PLAY_URL(name,url,iconimage): name,url,iconimage = url.split('|SPLIT|') name = name.replace('[COLOR white]','').replace('[/COLOR]','').replace(' - ','') ref_url = url id = url.split("/")[-2] if len(id) > 4: start = id[0:4] else: start = "0" if "/hd/" in url: base = 'http://cdn.justporno.sex/video_hd/' else: base = 'http://cdn.justporno.sex/video/' url = base + str(start) + "/" + id + ".mp4" dp = common.GET_LUCKY() #result = common.open_url(url) #url = re.compile('<iframe src="(.+?)" frameborder="0" scrolling="no"></iframe>',re.DOTALL).findall(result)[0] #video = common.open_url(url) #common.TextBoxes("%s" % video) #url = re.compile("video_url.+?'(.+?)'",re.DOTALL).findall(video)[0] url = url.replace("['",'').replace("']",'').replace('%3A%2F%2F','://').replace('%2F','/').replace('amp;','') choice = dialog.select("[COLOR red]Please select an option[/COLOR]", ['[COLOR pink]Watch Video[/COLOR]','[COLOR pink]Add to Favourites[/COLOR]','[COLOR pink]Download Video[/COLOR]']) if choice == 1: a=open(FAVOURITES_FILE).read() b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>Just Porno TV</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n') f= open(FAVOURITES_FILE, mode='w') f.write(str(b)) f.close() dp.close() dialog.ok(AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]") quit() elif choice == 2: try: download_location = plugintools.get_setting("download_location") download_folder = xbmc.translatePath(download_location) _in = url name = name.replace(' ','_').replace('[COLOR','').replace('[/COLOR','').replace('[I]','').replace(']','').replace('|','').replace('%','').replace('-','').replace('[/I','').replace('[/B','').replace('[','').replace('/','').replace(':','') _out = download_folder + name + '.mp4' dp.close() a=open(DOWNLOADS_FILE).read() b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(_out)+'</name>\n<icon>'+str(iconimage)+'</icon>\n</item>\n') f= open(DOWNLOADS_FILE, mode='w') f.write(str(b)) f.close() downloader.download(_in,_out,dp=None) dialog.ok(AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]") except: try: os.remove(_out) except: pass dp.close() dialog.ok(AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]") quit() elif choice == 0: history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a=open(HISTORY_FILE).read() b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<date>'+str(date_now)+'</date>\n<time>'+str(time_now)+'</time>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>Just Porno TV</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n') f= open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36&Referer=' + ref_url liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) dp.close() xbmc.Player ().play(url, liz, False) quit() else: dp.close() quit()
def PLAY_URL(name, url, iconimage): name, url, iconimage = url.split('|SPLIT|') name = name.replace("[COLOR orangered]HD[/COLOR][COLOR white] - ", '').replace("[COLOR yellow]SD[/COLOR][COLOR white] - ", '').replace('[/COLOR]', '').replace(' - ', '') dp = common.GET_LUCKY() url = "http://www.youporn.com" + url ref_url = url result = common.open_url(url) match = re.compile('sources: {(.+?)}', re.DOTALL).findall(result) a = str(match) match = a.replace('\\', '') try: url1 = re.compile("1080_60.+?'(.+?)',").findall(match)[0] except: url1 = "null" try: url2 = re.compile("1080.+?'(.+?)',").findall(match)[0] except: url2 = "null" try: url3 = re.compile("720_60+?'(.+?)',").findall(match)[0] except: url3 = "null" try: url4 = re.compile("720.+?'(.+?)',").findall(match)[0] except: url4 = "null" try: url5 = re.compile("480.+?'(.+?)',").findall(match)[0] except: url5 = "null" try: url6 = re.compile("240.+?'(.+?)',").findall(match)[0] except: url6 = "null" if "http" in url1: url_play = url1 elif "http" in url2: url_play = url2 elif "http" in url3: url_play = url3 elif "http" in url4: url_play = url4 elif "http" in url5: url_play = url5 elif "http" in url6: url_play = url6 url = url_play choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [ '[COLOR pink]Watch Video[/COLOR]', '[COLOR pink]Add to Favourites[/COLOR]', '[COLOR pink]Download Video[/COLOR]' ]) if choice == 1: a = open(FAVOURITES_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>YouPorn</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(FAVOURITES_FILE, mode='w') f.write(str(b)) f.close() dp.close() dialog.ok( AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]" ) quit() elif choice == 2: try: download_location = plugintools.get_setting("download_location") download_folder = xbmc.translatePath(download_location) _in = url name = name.replace(' ', '_').replace('[COLOR', '').replace( '[/COLOR', '').replace('[I]', '').replace(']', '').replace( '|', '').replace('%', '').replace('-', '').replace( '[/I', '').replace('[/B', '').replace('[', '').replace( '/', '').replace(':', '') _out = download_folder + name + '.mp4' dp.close() a = open(DOWNLOADS_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(_out) + '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(DOWNLOADS_FILE, mode='w') f.write(str(b)) f.close() downloader.download(_in, _out, dp=None) dialog.ok( AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]" ) except: try: os.remove(_out) except: pass dp.close() dialog.ok( AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]" ) quit() elif choice == 0: history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a = open(HISTORY_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' + str(date_now) + '</date>\n<time>' + str(time_now) + '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>YouPorn</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36&Referer=' + ref_url liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) dp.close() xbmc.Player().play(url, liz, False) else: dp.close() quit()
def PLAY_URL(name, url, iconimage): dp = common.GET_LUCKY() name, url, iconimage = url.split('|SPLIT|') r = common.open_url(url) i = re.compile('URL\[\]=([^"]+)" rel="countrycontainer">', re.DOTALL).findall(r) check = [ 'flashx', 'streamcloud', 'streamin', 'openload', 'thevideo', 'datoporn' ] urllist = [] for url2 in i: for a in check: if a in url2: urllist.append(url2) if len(urllist) == 0: dialog.ok(AddonTitle, 'Sorry, no links could be found for this video.') quit() elif len(urllist) == 1: url = urllist[0] else: domains = [] urls = [] for link in urllist: domain = urlparse.urlsplit(link)[1].split(':')[0] if 'www.' in domain: domain = domain.replace('www.', '') try: domain = domain.split('.')[0] except: pass domains.append(domain.title()) urls.append(link) select = dialog.select(name, domains) if select < 0: quit() else: url = urls[select] choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [ '[COLOR pink]Watch Video[/COLOR]', '[COLOR pink]Add to Favourites[/COLOR]', '[COLOR pink]Download Video[/COLOR]' ]) if choice == 1: a = open(FAVOURITES_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>Freeomovie</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(FAVOURITES_FILE, mode='w') f.write(str(b)) f.close() dp.close() dialog.ok( AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]" ) quit() elif choice == 2: try: download_location = plugintools.get_setting("download_location") download_folder = xbmc.translatePath(download_location) _in = url name = name.replace(' ', '_').replace('[COLOR', '').replace( '[/COLOR', '').replace('[I]', '').replace(']', '').replace( '|', '').replace('%', '').replace('-', '').replace( '[/I', '').replace('[/B', '').replace('[', '').replace( '/', '').replace(':', '') _out = download_folder + name + '.mp4' dp.close() a = open(DOWNLOADS_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(_out) + '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(DOWNLOADS_FILE, mode='w') f.write(str(b)) f.close() downloader.download(_in, _out, dp=None) dialog.ok( AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]" ) except: try: os.remove(_out) except: pass dp.close() dialog.ok( AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]" ) quit() elif choice == 0: history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a = open(HISTORY_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' + str(date_now) + '</date>\n<time>' + str(time_now) + '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>Freeomovie</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() url = urlresolver.HostedMediaFile(url).resolve() liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) dp.close() xbmc.Player().play(url, liz, False)
def PLAY_URL(name, url, iconimage): name, url = url.split('|SPLIT|') name = name.replace( '[COLOR white] - [/COLOR][COLOR deepskyblue]HD[/COLOR] - [COLOR white]', '').replace( '[COLOR white] - [/COLOR][COLOR orange]SD[/COLOR] - [COLOR white]', '').replace('[/COLOR]', '').replace(' - ', '') ref_url = url result = common.open_url(url) match = re.compile('html>(.+?)</html>', re.DOTALL).findall(result) a = str(match) match = a.replace('\\', '') choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [ '[COLOR pink]Watch Video[/COLOR]', '[COLOR pink]Add to Favourites[/COLOR]', '[COLOR pink]Download Video[/COLOR]' ]) dp = common.GET_LUCKY() if choice == 1: a = open(FAVOURITES_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>P**n.com</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(FAVOURITES_FILE, mode='w') f.write(str(b)) f.close() dp.close() dialog.ok( AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]" ) quit() elif choice == 2: try: try: size1 = re.compile( 'MP4 1080p<span class="hd"></span><span class="l1">(.+?)</span></a><a href=".+?"' ).findall(match)[0] url1 = re.compile( 'MP4 1080p<span class="hd"></span><span class="l1">.+?</span></a><a href="(.+?)"' ).findall(match)[0] except: size1 = "null" url1 = "null" try: size2 = re.compile( 'MP4 720p<span class="hd"></span><span class="l1">(.+?)</span></a><a href=".+?.mp4"' ).findall(match)[0] url2 = re.compile( 'MP4 720p<span class="hd"></span><span class="l1">.+?</span></a><a href="(.+?)"' ).findall(match)[0] except: size2 = "null" url2 = "null" try: size3 = re.compile( 'MP4 480p.+?<span class="l1">(.+?)</span></a><a href=".+?.mp4"' ).findall(match)[0] url3 = re.compile( 'MP4 480p.+?<span class="l1">.+?</span></a><a href="(.+?)"' ).findall(match)[0] except: size3 = "null" url3 = "null" try: size4 = re.compile( 'MP4 360p.+?<span class="l1">(.+?)</span></a><a href=".+?.mp4"' ).findall(match)[0] url4 = re.compile( 'MP4 360p.+?<span class="l1">.+?</span></a><a href="(.+?)"' ).findall(match)[0] except: size4 = "null" url4 = "null" if "download" in url1: choice = dialog.select( "[COLOR red]Please select an option[/COLOR]", [ '[COLOR deepskyblue]Download 1080p ' + str(size1) + '[/COLOR]', '[COLOR deepskyblue]Download 720p ' + str(size2) + '[/COLOR]', '[COLOR deepskyblue]Download 480p ' + str(size3) + '[/COLOR]', '[COLOR deepskyblue]Download 360p ' + str(size4) + '[/COLOR]' ]) if choice == 0: url_play = url1 elif choice == 1: url_play = url2 elif choice == 2: url_play = url3 elif choice == 3: url_play = url4 elif "download" in url2: choice = dialog.select( "[COLOR red]Please select an option[/COLOR]", [ '[COLOR deepskyblue]Download 720p ' + str(size2) + '[/COLOR]', '[COLOR deepskyblue]Download 480p ' + str(size3) + '[/COLOR]', '[COLOR deepskyblue]Download 360p ' + str(size4) + '[/COLOR]' ]) if choice == 0: url_play = url2 elif choice == 1: url_play = url3 elif choice == 2: url_play = url4 elif "download" in url3: choice = dialog.select( "[COLOR red]Please select an option[/COLOR]", [ '[COLOR deepskyblue]Download 480p ' + str(size3) + '[/COLOR]', '[COLOR deepskyblue]Download 360p ' + str(size4) + '[/COLOR]' ]) if choice == 0: url_play = url3 elif choice == 1: url_play = url4 elif "download" in url4: url_play = url4 download_location = plugintools.get_setting("download_location") download_folder = xbmc.translatePath(download_location) _in = 'http://www.p**n.com/' + url_play name = name.replace(' ', '_').replace('[COLOR', '').replace( '[/COLOR', '').replace('[I]', '').replace(']', '').replace( '|', '').replace('%', '').replace('-', '').replace( '[/I', '').replace('[/B', '').replace('[', '').replace( '/', '').replace(':', '') _out = download_folder + name + '.mp4' dp.close() a = open(DOWNLOADS_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<name>' + str(_out) + '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(DOWNLOADS_FILE, mode='w') f.write(str(b)) f.close() downloader.download(_in, _out, dp=None) dialog.ok( AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]" ) except: try: os.remove(_out) except: pass dp.close() dialog.ok( AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]" ) quit() elif choice == 0: history_on_off = plugintools.get_setting("history_setting") if history_on_off == "true": date_now = datetime.datetime.now().strftime("%d-%m-%Y") time_now = datetime.datetime.now().strftime("%H:%M") a = open(HISTORY_FILE).read() b = a.replace( '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' + str(date_now) + '</date>\n<time>' + str(time_now) + '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) + '</link>\n<site>P**n.com</site>\n<icon>' + str(iconimage) + '</icon>\n</item>\n') f = open(HISTORY_FILE, mode='w') f.write(str(b)) f.close() url_play = re.compile('{id:".+?",url:"(.+?)"').findall(match)[-1] url = url_play + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36&Referer=' + ref_url liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage) dp.close() xbmc.Player().play(url, liz, False) else: dp.close() quit()