def play_from_html(self, html): self.progress.update(50, "", "Searching for supported hosts", "") direct_links = None if self.direct_regex: direct_links = re.compile(self.direct_regex, re.DOTALL | re.IGNORECASE).findall(html) if direct_links: selected = 'https:' + direct_links[0] if direct_links[ 0].startswith('//') else direct_links[0] self.progress.update(50, "", "", "Playing from direct link") self.play_from_direct_link(selected) elif not self.regex: notify('Oh oh', 'Could not find a supported link') if self.regex and not direct_links: use_universal = True if addon.getSetting( "universal_resolvers") == "true" else False sources = self._clean_urls([ resolveurl.HostedMediaFile(x, title=x.split('/')[2], include_universal=use_universal) for x in resolveurl.scrape_supported(html, self.regex) ]) if not sources: notify('Oh oh', 'Could not find a supported link') return self._select_source(sources) if not self.direct_regex and not self.regex: raise ValueError("No regular expression specified")
def play_from_html(self, html, url=None): self.progress.update(40, "", "Searching for supported hosts", "") solved_suburls = self._check_suburls(html, url) self.progress.update(60, "", "Searching for supported hosts", "") direct_links = None if self.direct_regex: direct_links = re.compile(self.direct_regex, re.DOTALL | re.IGNORECASE).findall(html) if direct_links: selected = 'https:' + direct_links[0] if direct_links[0].startswith('//') else direct_links[0] self.progress.update(50, "", "", "Playing from direct link") self.play_from_direct_link(selected) elif not self.regex: notify('Oh oh','Could not find a supported link') if self.regex and not direct_links: scraped_sources = resolveurl.scrape_supported(html, self.regex) scraped_sources = scraped_sources if scraped_sources else [] scraped_sources.extend(solved_suburls) self.play_from_link_list(scraped_sources) if not self.direct_regex and not self.regex: raise ValueError("No regular expression specified")
def play_from_html(self, html): self.progress.update(50, "", "Searching for supported hosts", "") direct_links = re.compile("""<source.*?src=(?:"|')([^"']+)[^>]+>""", re.DOTALL | re.IGNORECASE).findall(html) if direct_links: selected = 'https:' + direct_links[0] if direct_links[ 0].startswith('//') else direct_links[0] hdr = dict(headers) hdr['Referer'] = selected self.play_from_direct_link(selected) else: use_universal = True if addon.getSetting( "universal_resolvers") == "true" else False sources = self._clean_urls([ resolveurl.HostedMediaFile(x, title=x.split('/')[2], include_universal=use_universal) for x in resolveurl.scrape_supported(html, self.regex) ]) if not sources: notify('Oh oh', 'Could not find a supported link') return self._select_source(sources)
url = build_url({'current_category': current_category[0], 'level': 'Folder', 'page': str(int(my_current_page)+1)}) li = xbmcgui.ListItem('Next..') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle) elif current_level[0] == 'Movie': # xbmc.log("------------------ Inside Movie -------------", level=xbmc.LOGNOTICE) my_current_movieURL = current_movie[0] # xbmc.log("Current Movie URL: " + my_current_movieURL, level=xbmc.LOGNOTICE) inputHTML = str(requests.get(my_current_movieURL).text) _start = inputHTML.find('<iframe') _end = inputHTML.rfind('/iframe>') inputHTML = inputHTML[_start:_end] # xbmc.log("Movie content : " + inputHTML, level=xbmc.LOGNOTICE) # xbmc.log(inputHTML, level=xbmc.LOGNOTICE) videoList = resolveurl.scrape_supported(inputHTML, regex= '''=\s*['"]([^'"]+)''') # xbmc.log(str(videoList), level=xbmc.LOGNOTICE) for video in videoList: playableURL = resolveurl.resolve(video) li = xbmcgui.ListItem(video) xbmcplugin.addDirectoryItem(handle=addon_handle, url=playableURL, listitem=li) xbmcplugin.endOfDirectory(addon_handle) # TODO : Render Main Menu from categories # TODO : Render List of movies from current categoryd
def play_from_html(self, html): self.progress.update(50, "", "Searching for supported hosts", "") direct_links = None if self.direct_regex: direct_links = re.compile(self.direct_regex, re.DOTALL | re.IGNORECASE).findall(html) if direct_links: selected = 'https:' + direct_links[0] if direct_links[0].startswith('//') else direct_links[0] self.progress.update(50, "", "", "Playing from direct link") self.play_from_direct_link(selected) elif not self.regex: notify('Oh oh','Could not find a supported link') if self.regex and not direct_links: use_universal = True if addon.getSetting("universal_resolvers") == "true" else False sources = self._clean_urls([resolveurl.HostedMediaFile(x, title=x.split('/')[2], include_universal=use_universal) for x in resolveurl.scrape_supported(html, self.regex)]) if not sources: notify('Oh oh','Could not find a supported link') return self._select_source(sources) if not self.direct_regex and not self.regex: raise ValueError("No regular expression specified")