def check_directstreams(url, hoster='', quality='SD'): urls = [] host = hoster if 'google' in url or any(x in url for x in ['youtube.', 'docid=']): urls = directstream.google(url) if not urls: tag = directstream.googletag(url) if tag: urls = [{'quality': tag[0]['quality'], 'url': url}] if urls: host = 'gvideo' elif 'ok.ru' in url: urls = directstream.odnoklassniki(url) if urls: host = 'vk' elif 'vk.com' in url: urls = directstream.vk(url) if urls: host = 'vk' elif any(x in url for x in ['akamaized', 'blogspot', 'ocloud.stream']): urls = [{'url': url}] if urls: host = 'CDN' direct = True if urls else False if not urls: urls = [{'quality': quality, 'url': url}] return urls, host, direct
def sources(self, url, hostDict, hostprDict): sources = [] try: if not url: return sources r = client.request(urlparse.urljoin(self.base_link, url)) r = dom_parser.parse_dom(r, 'article') r = dom_parser.parse_dom(r, 'div', attrs={'class': 'entry-content'}) links = re.findall('''(?:link|file)["']?\s*:\s*["'](.+?)["']''', ''.join([i.content for i in r])) links += [ l.attrs['src'] for i in r for l in dom_parser.parse_dom(i, 'iframe', req='src') ] links += [ l.attrs['src'] for i in r for l in dom_parser.parse_dom(i, 'source', req='src') ] for i in links: try: valid, hoster = source_utils.is_host_valid(i, hostDict) if not valid: continue urls = [] if 'google' in i: host = 'gvideo' direct = True urls = directstream.google(i) if 'google' in i and not urls and directstream.googletag( i): host = 'gvideo' direct = True urls = [{ 'quality': directstream.googletag(i)[0]['quality'], 'url': i }] elif 'ok.ru' in i: host = 'vk' direct = True urls = directstream.odnoklassniki(i) elif 'vk.com' in i: host = 'vk' direct = True urls = directstream.vk(i) else: host = hoster direct = False urls = [{ 'quality': 'SD', 'url': i }] for x in urls: sources.append({ 'source': host, 'quality': x['quality'], 'language': 'ko', 'url': x['url'], 'direct': direct, 'debridonly': False }) except: pass return sources except: return sources