Пример #1
0
 def resolve(self,item,captcha_cb=None,select_cb=None):
     item = item.copy()
     url = self._url(item['url']).replace('×', '%c3%97')
     data = util.substr(util.request(url), '<div id=\"content\"', '#content')
     visionone_resolved, onevision_resolved, scz_resolved = [],[],[]
     
     onevision = re.search('(?P<url>http://onevision\.ucoz\.ua/[^<]+)', data, re.IGNORECASE)
     if onevision:
         onevision_data = util.substr(util.request(onevision.group('url')),'<td class=\"eText\"','<td class=\"rightColumn\"')
         onevision_resolved=resolver.findstreams(onevision_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
     
     visionone = re.search('(?P<url>http://visionone\.ucoz\.ru/[^<]+)', data, re.IGNORECASE)
     if visionone:
         visionone_data = util.substr(util.request(visionone.group('url')),'<td class=\"eText\"','<td class=\"rightColumn\"')
         visionone_resolved = resolver.findstreams(visionone_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
     scz = re.search('(?P<url>http://scz\.uvadi\.cz/\?p=[\d]+)', data, re.IGNORECASE)
     if scz:
         scz_data = util.substr(util.request(scz.group('url')),'<div id=\"content\"', '#content')
         scz_resolved = resolver.findstreams(scz_data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                               '<object(.+?)data=\"(?P<url>[^\"]+)',
                                               '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                               '<object.*?data=(?P<url>.+?)</object>'])
         
     serialy_resolved = resolver.findstreams(data, ['<embed( )src=\"(?P<url>[^\"]+)',
                                            '<object(.+?)data=\"(?P<url>[^\"]+)',
                                            '<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]',
                                            '<object.*?data=(?P<url>.+?)</object>',
                                            '<p><code><strong>(?P<url>http.+?)</strong></code></p>',
                                            '<p><code><strong><big>(?P<url>.+?)</big></strong></code></p>'])
     
     resolved = []
     resolved+= serialy_resolved or []
     resolved+= visionone_resolved or []
     resolved+= onevision_resolved or []
     resolved+= scz_resolved or []
     resolved = len(resolved) > 0 and resolved or None
     
     result = []
     for i in resolved:
         item = self.video_item()
         item['title'] = i['name']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['headers'] = i['headers']
         result.append(item) 
     if len(result) == 1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
    def resolve(self, item, captcha_cb=None, select_cb=None):
        result = []
        resolved = []
        item = item.copy()
        url = self._url(item['url'])
        data = util.substr(util.request(url), '<div class=\"postContent\"', '</div>')
        playlist = re.search('playlistfile=(.+?\.xml)', data)
        if playlist:
            playlistxml = fromstring(util.request(playlist.group(1))).find('channel')
            jwplayer_ns = '{http://developer.longtailvideo.com/}'
            for item in playlistxml.findall('item'):
                title = item.find('title').text
                url = item.find(jwplayer_ns + 'file').text
                subs = item.find(jwplayer_ns + 'captions.file')
                subs = subs is not None and self._url(subs.text)
                res = resolver.findstreams(url, ['(?P<url>^.+?$)']) or []
                for i in res:
                    i['title'] = title
                    i['subs'] = subs
                resolved += res[:]
        else:
            resolved = resolver.findstreams(data, ['file=(?P<url>[^&]+)&amp'])
            subs = re.search('captions\.file=.*?(http[^&]+)&amp', data)
            if resolved and subs:
                for i in resolved:
                    i['subs'] = subs.group(1)

        if not resolved:
            raise ResolveException('Video nenalezeno')
        for i in resolved:
            item = self.video_item()
            try:
                item['title'] = i['title']
            except KeyError:
                pass
            item['url'] = i['url']
            item['quality'] = i['quality']
            item['surl'] = i['surl']
            item['subs'] = i['subs']
            item['headers'] = i['headers']
            try:
                item['fmt'] = i['fmt']
            except KeyError:
                pass
            result.append(item)
        if len(result) > 0 and select_cb:
            return select_cb(result)
        return result
Пример #3
0
    def findstreams(self,data,regexes):
        """
        Find's streams (see resovler.findstreams for more details)

        Args:
            datai (str): data (piece of HTML for example) to search links
            regexes (array): array of regexes to search interesting urls in data
        Returns:
            array of video items
        """
        resolved = resolver.findstreams(data,regexes)
        if resolved == None:
            raise ResolveException('Nelze ziskat video link [CR]zkontrolujte jestli video nebylo odstraneno')
        if resolved == False:
            raise ResolveException('Nebyl nalezen zadny video embed [CR]zkontrolujte stranku pripadne nahlaste chybu pluginu')
        if resolved == []:
            raise ResolveException('Video je na serveru, ktery neni podporovan')
        result = []
        for j in resolved:
            i = defaultdict(lambda:'',j)
            item = self.video_item() 
            item['title'] = i['name']
            item['url'] = i['url']
            item['quality'] = i['quality']
            item['surl'] = i['surl']
            item['subs'] = i['subs']
            item['headers'] = i['headers']
            item['lang'] = i['lang']
            item['info'] = i['info']
            result.append(item)
        return result
Пример #4
0
    def findstreams(self, data, regexes=None):
        """
        Finds streams in given data (see resovler.findstreams for more details)

        :param data: A string (piece of HTML, for example) or an array of URLs
        :param regexes: An array of regexes to be used for extracting URLs from
                        'data' of type 'string'
        :returns: An array of video items
        """
        resolved = resolver.findstreams(data, regexes)
        if resolved is None:
            raise ResolveException(
                'Nelze ziskat video link [CR]zkontrolujte jestli video nebylo odstraneno'
            )
        elif isinstance(resolved, list) and not resolved:
            raise ResolveException(
                'Video je na serveru, ktery neni podporovan')
        elif not resolved:
            raise ResolveException(
                'Nebyl nalezen zadny video embed [CR]zkontrolujte stranku pripadne nahlaste chybu pluginu'
            )
        result = []
        for j in resolved:
            i = defaultdict(lambda: '', j)
            item = self.video_item()
            item['title'] = i['name']
            item['url'] = i['url']
            item['quality'] = i['quality']
            item['surl'] = i['surl']
            item['subs'] = i['subs']
            item['headers'] = i['headers']
            item['lang'] = i['lang']
            item['info'] = i['info']
            result.append(item)
        return result
Пример #5
0
 def resolve(self, item, captcha_cb=None, select_cb=None):
     item = item.copy()
     url = self._url(item["url"])
     data = util.request(self._url(item["url"]))
     data = util.substr(data, '<div class="video', "</div")
     sosac = re.search('"(http\://[\w]+\.sosac\.ph[^"]+)', data, re.DOTALL)
     if sosac:
         data = util.request(sosac.group(1))
     resolved = resolver.findstreams(
         data,
         [
             '<embed( )*flashvars="file=(?P<url>[^"]+)',
             '<embed( )src="(?P<url>[^"]+)',
             '<object(.+?)data="(?P<url>[^"]+)',
             "<iframe(.+?)src=[\"' ](?P<url>.+?)['\" ]",
             "<object.*?data=(?P<url>.+?)</object>",
         ],
     )
     result = []
     if not resolved:
         self.error("Nothing resolved")
     for i in resolved:
         item = self.video_item()
         item["title"] = i["name"]
         item["url"] = i["url"]
         item["quality"] = i["quality"]
         item["surl"] = i["surl"]
         item["subs"] = i["subs"]
         item["headers"] = i["headers"]
         result.append(item)
     if len(result) == 1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
Пример #6
0
 def resolve(self, item, captcha_cb=None, select_cb=None):
     result = []
     item = item.copy()
     page = util.request(self._url(item['url']))
     for m in re.finditer(r'jwplayer\("([^"]+)"\)\.setup\((.+?)\)', page, re.DOTALL):
         jw_title, jw_data = m.group(1), m.group(2)
         vurl_match = re.search(r'file:\s*"([^"]+)', jw_data, re.DOTALL)
         subs_match = re.search(r'tracks:\s*\[\{\s*file:\s*"([^"]+)', jw_data, re.DOTALL)
         if vurl_match:
             vurl = re.sub(r'youtu.be/', r'www.youtube.com/watch?v=', vurl_match.group(1))
             resolved = resolver.findstreams([vurl])
             if resolved:
                 for i in resolved:
                     item = self.video_item()
                     item['title'] = i['title']
                     item['url'] = i['url']
                     item['quality'] = i['quality']
                     item['surl'] = i['surl']
                     if subs_match:
                         item['subs'] = self._url(subs_match.group(1))
                     item['headers'] = i['headers']
                     try:
                         item['fmt'] = i['fmt']
                     except KeyError:
                         pass
                     result.append(item)
     if len(result) == 1:
         return result[0]
     elif len(result) >= 1:
         if select_cb is not None:
             return select_cb(result)
         return result[0]
     return None
Пример #7
0
 def resolve(self,item,captcha_cb=None,select_cb=None):
     item = item.copy()
     url = self._url(item['url'])
     data = util.request(self._url(item['url']))	
     data = util.substr(data,'<div class=\"video','</div')
     sosac = re.search('\"(http\://[\w]+\.sosac\.ph[^\"]+)',data,re.DOTALL)
     if sosac:
         data = util.request(sosac.group(1))
     resolved = resolver.findstreams(data,[
         '<embed( )*flashvars=\"file=(?P<url>[^\"]+)',
         '<embed( )src=\"(?P<url>[^\"]+)',
         '<object(.+?)data=\"(?P<url>[^\"]+)',
         '<iframe(.+?)src=[\"\' ](?P<url>.+?)[\'\" ]',
         ])
     result = []
     if not resolved:
         self.error('Nothing resolved')
     for i in resolved:
         item = self.video_item()
         item['title'] = i['name']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['subs'] = i['subs']
         result.append(item)	
     if len(result)==1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
Пример #8
0
    def resolve(self, item, captcha_cb=None, select_cb=None):
        item = item.copy()
        url = self._url(item["url"])
        # print 'URL: '+url
        hdata = util.request(url)

        data = util.substr(hdata, '<div id="file_box"', '<ul class="tab_menu"')

        resolved = resolver.findstreams(
            data,
            [
                'flash[V|v]ars="(?P<url>id=.+?)" ',
                '<embed( )src="(?P<url>[^"]+)',
                '<object(.+?)data="(?P<url>[^"]+)',
                "<iframe(.+?)src=[\"'](?P<url>.+?)['\"]",
                '(?P<url>"http://www.youtube.com/[^"]+)',
            ],
        )
        result = []
        for i in resolved:
            print i
            item = self.video_item()
            item["title"] = i["name"]
            item["url"] = i["url"]
            item["quality"] = i["quality"]
            item["surl"] = i["surl"]
            result.append(item)
        if len(result) == 1:
            return result[0]
        elif len(result) > 1 and select_cb:
            return select_cb(result)
    def findstreams(self, data, regexes=None):
        """
        Finds streams in given data (see resovler.findstreams for more details)

        :param data: A string (piece of HTML, for example) or an array of URLs
        :param regexes: An array of regexes to be used for extracting URLs from
                        'data' of type 'string'
        :returns: An array of video items
        """
        resolved = resolver.findstreams(data, regexes)
        if resolved is None:
            raise ResolveException(
                'Nelze ziskat video link [CR]zkontrolujte jestli video nebylo odstraneno')
        elif isinstance(resolved, list) and not resolved:
            raise ResolveException('Video je na serveru, ktery neni podporovan')
        elif not resolved:
            raise ResolveException(
                'Nebyl nalezen zadny video embed [CR]zkontrolujte stranku pripadne nahlaste chybu pluginu')
        result = []
        for j in resolved:
            i = defaultdict(lambda: '', j)
            item = self.video_item()
            item['title'] = i['name']
            item['url'] = i['url']
            item['quality'] = i['quality']
            item['surl'] = i['surl']
            item['subs'] = i['subs']
            item['headers'] = i['headers']
            item['lang'] = i['lang']
            item['info'] = i['info']
            result.append(item)
        return result
Пример #10
0
 def resolve(self, item, captcha_cb=None, select_cb=None):
     page = util.request(self._url(item['url']))
     data = util.substr(page, '<div id=\"video', '<div id=\"controller')
     data = re.sub('youtube-nocookie.com', 'youtube.com', data)
     resolved = resolver.findstreams(data, [
         '<embed( )src=\"(?P<url>[^\"]+)',
         '<object(.+?)data=\"(?P<url>[^\"]+)',
         '<iframe(.+?)src=\"(?P<url>[^\"]+)'
     ])
     result = []
     if not resolved:
         raise ResolveException('Video nenalezeno')
     for i in resolved:
         item = self.video_item()
         item['title'] = i['title']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['headers'] = i['headers']
         result.append(item)
     result = sorted(result, key=lambda x: x['title'])
     if len(result) == 1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
Пример #11
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		#print 'URL: '+url
		hdata = util.request(url)
		
		data = util.substr(hdata,'<div id=\'video\'>','<div id="pravy">')
			
		resolved = resolver.findstreams(data,['flash[V|v]ars=\"(?P<url>id=.+?)\" ','<embed( )src=\"(?P<url>[^\"]+)','<object(.+?)data=\"(?P<url>[^\"]+)','<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]','href="(?P<url>http://(www.)?streamcloud\.eu.+?)"'])
                result = []
                try:
			for i in resolved:
				item = self.video_item()
				item['title'] = i['name']
				item['url'] = i['url']
				item['quality'] = i['quality']
				item['surl'] = i['surl']
				result.append(item)  
		except:
			print '===Unknown resolver==='
			
                if len(result)==1:
                        return result[0]
                elif len(result) > 1 and select_cb:
                        return select_cb(result)
Пример #12
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		print 'URL: '+url
		data = util.request(url)
		
		pattern = 'videoId: \'(?P<vid>.+?)[\'?]'
		m = re.search(pattern, data, re.IGNORECASE | re.DOTALL)
		if not m == None:
			url = 'http://www.youtube.com/watch?v='+m.group('vid')
		
		resolved = resolver.findstreams(url,['(?P<url>http://www.youtube.com/watch\?v='+m.group('vid')+')'])
		result = []
		try:
			for i in resolved:
				item = self.video_item()
				item['title'] = i['name']
				item['url'] = i['url']
				item['quality'] = i['quality']
				item['surl'] = i['surl']
				result.append(item)  
		except:
			print '===Unknown resolver==='
			
		if len(result)==1:
			return result[0]
		elif len(result) > 1 and select_cb:
			return select_cb(result)
Пример #13
0
 def resolve(self, item, captcha_cb=None, select_cb=None):
     result = []
     item = item.copy()
     url = self._url(item['url'])
     data = util.substr(util.request(url), '<embed id', '>')
     yurl_m = re.search('file=.*?(http[^&]+)&',data,re.DOTALL)
     yurl = yurl_m and re.sub('youtu.be/','www.youtube.com/watch?v=',yurl_m.group(1)) or ''
     resolved = resolver.findstreams(yurl, ['(?P<url>[^&]+)'])
     subs = re.search('captions\.file=([^&]+)', data, re.DOTALL)
     if resolved and subs:
         for i in resolved:
             i['subs'] = self._url(subs.group(1))
     if not resolved:
         raise ResolveException('Video nenalezeno')
     for i in resolved:
         item = self.video_item()
         item['title'] = i['title']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['subs'] = i['subs']
         item['headers'] = i['headers']
         try:
             item['fmt'] = i['fmt']
         except KeyError:
             pass
         print item
         result.append(item)
     if len(result)  == 0:
         return result[0]
     return select_cb(result)
Пример #14
0
 def resolve(self,item,captcha_cb=None,select_cb=None):
     item = item.copy()
     url = self._url(item['url'])
     data = util.request(self._url(item['url']))	
     data = util.substr(data,'<div id=\"stred','<div id=\'patka>')
     resolved = resolver.findstreams(data,[
         '<embed( )*flashvars=\"file=(?P<url>[^\"]+)',
         '<embed( )src=\"(?P<url>[^\"]+)',
         '<object(.+?)data=\"(?P<url>[^\"]+)',
         '<iframe(.+?)src=[\"\' ](?P<url>.+?)[\'\" ]',
         ])
     result = []
     if not resolved:
         self.error('Nothing resolved')
     for i in resolved:
         item = self.video_item()
         item['title'] = i['name']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['subs'] = i['subs']
         result.append(item)	
     if len(result)==1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
    def resolve(self, item, captcha_cb=None, select_cb=None):
        result = []
        resolved = []
        item = item.copy()
        url = self._url(item['url'])
        data = util.substr(util.request(url), 'async type', '</script>')
        print 'data start ----'
        print data
        print 'data end ----'
        playlist = re.search(
            '''new mfJWPlayer.+?(?P<jsondata>playlist:.+?)events:''', data,
            re.MULTILINE | re.DOTALL)
        print 'playlist start ----'
        print playlist
        print 'playlist end ----'
        jsondata = re.sub(
            ' +', ' ', '{%s' %
            playlist.group('jsondata').replace('file:', '"file":').replace(
                'label:', '"label":').replace('kind:', '"kind":').replace(
                    'default:', '"default":').replace(
                        'true', '"true"').replace('],', ']')) + '}'
        print 'jsondata start ----'
        print jsondata
        print 'jsondata end ----'
        jsondata = demjson.decode(jsondata)

        for playlist_item in jsondata['playlist']:
            video_url = resolver.findstreams([playlist_item['file']])
            subs = playlist_item['tracks']
            if video_url and subs:
                for i in video_url:
                    i['subs'] = self.base_url[:-1] + subs[0]['file']
            resolved += video_url[:]

            if not resolved:
                raise ResolveException('Video nenalezeno')

            for i in resolved:
                item = self.video_item()
                try:
                    item['title'] = i['title']
                except KeyError:
                    pass
                item['url'] = i['url']
                item['quality'] = i['quality']
                item['surl'] = i['surl']
                item['subs'] = i['subs']
                item['headers'] = i['headers']
                try:
                    item['fmt'] = i['fmt']
                except KeyError:
                    pass
                result.append(item)

        if len(result) > 0 and select_cb:
            return select_cb(result)

        return result
    def resolve(self, item, captcha_cb=None, select_cb=None):
        result = []
        resolved = []
        item = item.copy()
        url = self._url(item['url'])
        data = util.substr(util.request(url), 'async type', '</script>')
        print 'data start ----'
        print data
        print 'data end ----'
        playlist = re.search('''new mfJWPlayer.+?(?P<jsondata>playlist:.+?)events:''',
                             data, re.MULTILINE | re.DOTALL)
        print 'playlist start ----'
        print playlist
        print 'playlist end ----'
        jsondata = re.sub(' +',
                          ' ',
                          '{%s' % playlist.group('jsondata').replace('file:','"file":').replace('label:','"label":').replace('kind:','"kind":').replace('default:','"default":').replace('true','"true"').replace('],',']'))+'}'
        print 'jsondata start ----'
        print jsondata
        print 'jsondata end ----'
        jsondata = demjson.decode(jsondata)

        for playlist_item in jsondata['playlist']:
            playlist_item['file'] = playlist_item['file'].replace('time_continue=1&', '')
            video_url = resolver.findstreams([playlist_item['file']])
            subs = playlist_item['tracks']
            if video_url and subs:
                for i in video_url:
                    i['subs'] = self.base_url[:-1]+subs[0]['file']
            resolved += video_url[:]

            if not resolved:
                raise ResolveException('Video nenalezeno')

            for i in resolved:
                item = self.video_item()
                try:
                    item['title'] = i['title']
                except KeyError:
                    pass
                item['url'] = i['url']
                item['quality'] = i['quality']
                item['surl'] = i['surl']
                item['subs'] = i['subs']
                item['headers'] = i['headers']
                try:
                    item['fmt'] = i['fmt']
                except KeyError:
                    pass
                result.append(item)

        if len(result) > 0 and select_cb:
            return select_cb(result)
            
        return result
Пример #17
0
    def resolve(self, item, captcha_cb=None, select_cb=None):
        result = []
        item = item.copy()
        page = util.request(self._url(item['url']))
        for m in re.finditer(r'dailymotion.com/embed/video/.+?"', page,
                             re.DOTALL):
            resolved = resolver.findstreams([m.group(0)])
            return select_cb(resolved)

        for m in re.finditer(r'jwplayer\("([^"]+)"\)\.setup\((.+?)\)', page,
                             re.DOTALL):
            jw_title, jw_data = m.group(1), m.group(2)
            vurl_match = re.search(r'file:\s*"([^"]+)', jw_data, re.DOTALL)
            subs_match = re.search(r'tracks:\s*\[\{\s*file:\s*"([^"]+)',
                                   jw_data, re.DOTALL)
            if vurl_match:
                vurl = re.sub(r'youtu.be/', r'www.youtube.com/watch?v=',
                              vurl_match.group(1))
                resolved = resolver.findstreams([vurl])
                if resolved:
                    for i in resolved:
                        item = self.video_item()
                        item['title'] = i['title']
                        item['url'] = i['url']
                        item['quality'] = i['quality']
                        item['surl'] = i['surl']
                        if subs_match:
                            item['subs'] = self._url(subs_match.group(1))
                        item['headers'] = i['headers']
                        try:
                            item['fmt'] = i['fmt']
                        except KeyError:
                            pass
                        result.append(item)
        if len(result) == 1:
            return result[0]
        elif len(result) >= 1:
            if select_cb is not None:
                return select_cb(result)
            return result[0]
        return None
Пример #18
0
    def resolve(self, item, captcha_cb=None, select_cb=None):
        streams = []
        page = util.parse_html(item['url'])
        pattern = r'\+?"([^"])"\+?'
        link = re.sub(pattern,lambda n:n.group(1),page.find('script',text=re.compile(r'"."')).text)
	link = re.search(r'''(http://[^'"]+)''',link).group(1)
	link = link.replace('\n','')
        if u'mp4' in link:
	    return {'url':link, 'subs':''}
        else:
            result=resolver.findstreams([str(link)])
            return result[0]
Пример #19
0
def resolve(url):
	data = util.substr(util.request(url),'<div class=\"postContent\"','</div>')
	youtube.__eurl__ = 'http://www.videacesky.cz/wp-content/plugins/jw-player-plugin-for-wordpress/player.swf'
	resolved = resolver.findstreams(__addon__,data,['<iframe src=\"(?P<url>[^\"]+)','\;file=(?P<url>[^\&]+)'])
	print resolved
	if resolved == None:
		xbmcgui.Dialog().ok(__scriptname__,__language__(30002))
		return
	if not resolved == {}:
		# search for subs
		m = re.search('captions\.file=(?P<sub>[^\&]+)',data)
		if m:
			resolved['subs'] = m.group('sub')
		return resolved
Пример #20
0
 def resolve(self,item,captcha_cb=None,select_cb=None):
     item = item.copy()
     url = self._url(item['url']).replace('×','%c3%97')
     data = util.substr(util.request(url),'<div id=\"content\"','#content')
     resolved = resolver.findstreams(data,['<embed( )src=\"(?P<url>[^\"]+)','<object(.+?)data=\"(?P<url>[^\"]+)','<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]'])
     result = []
     for i in resolved:
         item = self.video_item()
         item['title'] = i['name']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         result.append(item)     
         if len(result)==1:
             return result[0]
         elif len(result) > 1 and select_cb:
             return select_cb(result)
Пример #21
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		data = util.request(url)
		resolved = resolver.findstreams(data,['\'file\'\: \'(?P<url>[^\']+)'])
                result = []
		for i in resolved:
                        item = self.video_item()
                        item['title'] = i['name']
                        item['url'] = i['url']
                        item['quality'] = i['quality']
                        item['surl'] = i['surl']
                        result.append(item)     
                if len(result)==1:
                        return result[0]
                elif len(result) > 1 and select_cb:
                        return select_cb(result)
Пример #22
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		data = util.substr(util.request(url),'<div class=\"zoomVideo','</div>')
		resolved = resolver.findstreams(data,['<object(.+?)data=\"(?P<url>http\://www\.youtube\.com/v/[^\&]+)'])
                result = []
		for i in resolved:
                        item = self.video_item()
                        item['title'] = i['name']
                        item['url'] = i['url']
                        item['quality'] = i['quality']
                        item['surl'] = i['surl']
                        result.append(item)     
                if len(result)==1:
                        return result[0]
                elif len(result) > 1 and select_cb:
                        return select_cb(result)
Пример #23
0
    def resolve(self, item, captcha_cb=None, select_cb=None):
        result = []
        resolved = []
        item = item.copy()
        url = self._url(item['url'])
        data = util.substr(util.request(url),
                           'jQuery( document ).ready(function()', '</script>')
        print 'data start ----'
        print data
        print 'data end ----'

        urls = re.findall('file:[ ]+\"(?P<url>[^\"].+?)\"', data,
                          re.IGNORECASE | re.DOTALL | re.MULTILINE)
        video_url = resolver.findstreams([
            urls[0].replace('https://youtu.be/',
                            'https://www.youtube.com/watch?v=')
        ])
        print video_url
        subs = urls[1]

        if video_url and subs:
            for i in video_url:
                i['subs'] = subs
        resolved += video_url[:]

        if not resolved:
            raise ResolveException('Video nenalezeno')

        for i in resolved:
            item = self.video_item()
            try:
                item['title'] = i['title']
            except KeyError:
                pass
            item['url'] = i['url']
            item['quality'] = i['quality']
            item['surl'] = i['surl']
            item['subs'] = i['subs']
            item['headers'] = i['headers']
            try:
                item['fmt'] = i['fmt']
            except KeyError:
                pass
            result.append(item)
        return result
Пример #24
0
 def resolve(self, item, captcha_cb=None, select_cb=None):
     item = item.copy()
     url = self._url(item["url"])
     data = util.request(url)
     data = util.substr(data, '<div class="video', "</div>")
     resolved = resolver.findstreams(data, ['<embed( )src="(?P<url>[^"]+)'])
     result = []
     for i in resolved:
         item = self.video_item()
         item["title"] = i["name"]
         item["url"] = i["url"]
         item["quality"] = i["quality"]
         item["surl"] = i["surl"]
         result.append(item)
     if len(result) == 1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
 def resolve(self, item, captcha_cb=None, select_cb=None):
     item = item.copy()
     url = self._url(item['url'])
     data = util.request(url)
     resolved = resolver.findstreams(data,
                                     ["\'file\'\:.?\'(?P<url>[^\']+)"])
     result = []
     for i in resolved:
         item = self.video_item()
         item['title'] = i['name']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         result.append(item)
     if len(result) == 1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
Пример #26
0
    def resolve(self,item,captcha_cb=None,select_cb=None):
        item = item.copy()
        url = self._url(item['url'])
        data = util.request(url)
        data = util.substr(data,'<div class=\'obsah\'','</div>')
        resolved = resolver.findstreams(data,['[\"|\']+(?P<url>http://[^\"|\'|\\\]+)','flashvars=\"file=(?P<url>[^\"|\\\]+)','file=(?P<url>[^\&]+)','<object.*?data=(?P<url>.+?)</object>'])
        result = []
        for i in resolved:
		item = self.video_item()
		item['title'] = i['name']
		item['url'] = i['url']
		item['quality'] = i['quality']
		item['surl'] = i['surl']
		result.append(item)     
        if len(result)==1:
		return result[0]
        elif len(result) > 1 and select_cb:
		return select_cb(result)
Пример #27
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		#print 'URL: '+url
		hdata = util.request(url)
		data = util.substr(hdata,'<div id="bigPlayer">','</div>')
		resolved = resolver.findstreams(data,['flash[V|v]ars=\"(?P<url>id=.+?)\" ','<embed( )src=\"(?P<url>[^\"]+)','<object(.+?)data=\"(?P<url>[^\"]+)','<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]','(?P<url>\"http://www.youtube.com/[^\"]+)'])
                result = []
		for i in resolved:
                        item = self.video_item()
                        item['title'] = i['name']
                        item['url'] = i['url'] 
                        item['quality'] = i['quality']
                        item['surl'] = i['surl']
                        result.append(item)  
                if len(result)==1:
                        return result[0]
                elif len(result) > 1 and select_cb:
                        return select_cb(result)
Пример #28
0
 def resolve(self,item,captcha_cb=None,select_cb=None):
     page = util.request(self._url(item['url']))
     data = util.substr(page,'<div id=\"video','<div id=\"controller')
     resolved = resolver.findstreams(data,['<embed( )src=\"(?P<url>[^\"]+)','<object(.+?)data=\"(?P<url>[^\"]+)','<iframe(.+?)src=\"(?P<url>[^\"]+)'])
     result = []
     if not resolved:
         raise ResolveException('Video nenalezeno')
     for i in resolved:
         item = self.video_item()
         item['title'] = i['title']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['headers'] = i['headers']
         result.append(item)
     result = sorted(result,key=lambda x:x['title'])
     if len(result)==1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
Пример #29
0
    def resolve(self, item, captcha_cb=None, select_cb=None):
        result = []
        resolved = []
        item = item.copy()
        url = self._url(item['url'])
        data = util.substr(util.request(url), '<![CDATA[', '</script>')

        playlist = re.search('''ihv_video_instance_\d+\.setup.+?(?P<jsondata>'playlist':.+?)width:''', data, re.MULTILINE | re.DOTALL)
	jsondata = re.sub(' +',' ','{%s' % playlist.group('jsondata').replace('file:','"file":').replace('label:','"label":').replace('kind:','"kind":').replace('default:','"default":').replace('tracks','"tracks"').replace('true','"true"').replace('],',']'))+'}'
        jsondata = json.loads(jsondata.replace("'",'"'))

        for playlist_item in jsondata['playlist']:
            video_url = resolver.findstreams([playlist_item['file']])
            subs = playlist_item['tracks']
            if video_url and subs:
                for i in video_url:
                    i['subs'] = self.base_url[:-1]+subs[0]['file']
            resolved += video_url[:]

        if not resolved:
            raise ResolveException('Video nenalezeno')

        for i in resolved:
            item = self.video_item()
            try:
                item['title'] = i['title']
            except KeyError:
                pass
            item['url'] = i['url']
            item['quality'] = i['quality']
            item['surl'] = i['surl']
            item['subs'] = i['subs']
            item['headers'] = i['headers']
            try:
                item['fmt'] = i['fmt']
            except KeyError:
                pass
            result.append(item)
        if len(result) > 0 and select_cb:
            return select_cb(result)
        return result
Пример #30
0
 def resolve(self,item,captcha_cb=None,select_cb=None):
     item = item.copy()
     url = self._url(item['url'])
     data = util.substr(util.request(url),'<a name=\"video\"','<div class=\"line_line')
     resolved = resolver.findstreams(data+url,['<embed( )src=\"(?P<url>[^\"]+)','<object(.+?)data=\"(?P<url>[^\"]+)','<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]'])
     result = []
     if not resolved:
         util.info('Nothing resolved :-(')
         return
     for i in resolved:
         item = self.video_item()
         item['title'] = i['name']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['subs'] = i['subs']
         result.append(item)     
     if len(result)==1:
         return result[0]
     elif len(result) > 1 and select_cb:
         return select_cb(result)
Пример #31
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		page = util.parse_html(url)
		result = []
		data=str(page.select('div.entry3 > center')[0])
		resolved = resolver.findstreams(data,['<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]'])
		try:
			for i in resolved:
				item = self.video_item()
				item['title'] = i['name']
				item['url'] = i['url']
				item['quality'] = i['quality']
				item['surl'] = i['surl']
				result.append(item)	 
		except:
			print '===Unknown resolver==='
			
		if len(result)==1:
			return result[0]
		elif len(result) > 1 and select_cb:
			return select_cb(result)
Пример #32
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		data = util.request(url)
		data = util.substr(data,'<div id="content">','<div class="clear">')
		resolved = resolver.findstreams(data,['flash[V|v]ars=\"(?P<url>id=.+?)\" ','<embed( )src=\"(?P<url>[^\"]+)','<object(.+?)data=\"(?P<url>[^\"]+)','<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]'])
                result = []
                try:
			for i in resolved:
				item = self.video_item()
				item['title'] = i['name']
				item['url'] = i['url']
				item['quality'] = i['quality']
				item['surl'] = i['surl']
				result.append(item)  
		except:
			print '===Unknown resolver==='
			
                if len(result)==1:
                        return result[0]
                elif len(result) > 1 and select_cb:
                        return select_cb(result)
Пример #33
0
	def resolve(self,item,captcha_cb=None,select_cb=None):
		item = item.copy()
		url = self._url(item['url'])
		#print 'URL: '+url
		hdata = util.request(url)
		
		data = util.substr(hdata,'<div class=\"AWD_like_button','<div class=\"postmetadata\">')
		
			
		resolved = resolver.findstreams(data,['flash[V|v]ars=\"(?P<url>id=.+?)\" ','<embed( )src=\"(?P<url>[^\"]+)','<object(.+?)data=\"(?P<url>[^\"]+)','<iframe(.+?)src=["|\'](?P<url>.+?)["|\']','href="(?P<url>http://(www.)?streamcloud\.eu.+?)"'])
                result = []
		for i in resolved:
                        item = self.video_item()
                        item['title'] = i['name']
                        item['url'] = i['url']
                        item['quality'] = i['quality']
                        item['surl'] = i['surl']
                        result.append(item)  
                if len(result)==1:
                        return result[0]
                elif len(result) > 1 and select_cb:
                        return select_cb(result)
Пример #34
0
def play_video(path):
    """
    Play a video by the provided path.

    :param path: Fully-qualified video URL
    :type path: str
    """
    # get video link
    html = fetchUrl(path, "Loading video...")
    if html:
        url = re.search(
            r'src="(https:\/\/video\.onnetwork\.tv\S+?)"><\/script>', html)
        if url:
            url = url.group(1)
            html = fetchUrl(url, "Loading video...")
            videoID = re.search(r'mid:\"(\S+?)\",', html).group(1)
            #url=re.search(r'frameSrc : "(\S+?)"', html).group(1)
            url = 'https://video.onnetwork.tv/frame86.php?mid=' + videoID
            html = fetchUrl(url, "Loading video...", path)
            url = re.search(r'id : \d+,.*?],url:"(\S*3u8)', html).group(1)
            #choose highest quality
            httpdata = fetchUrl(url, "Loading playlist...")
            streams = re.compile('RESOLUTION=\d+x(\d+).*\n([^#].+)').findall(
                httpdata)
            streams.sort(key=lambda x: int(x[0]), reverse=True)
            videolink = url.rsplit('/', 1)[0] + '/' + streams[0][1]
        else:
            resolved = resolver.findstreams(
                html, ['src="(?P<url>https:\/\/www.youtube.com\/\S+?)"'])
            if not resolved:
                xbmcgui.Dialog().ok('Chyba', 'Video nie je dostupné')
                return False
            videolink = resolved[0]['url']
        logN("Playing video " + videolink)
        play_item = xbmcgui.ListItem(path=videolink)
        # Pass the item to the Kodi player.
        xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
Пример #35
0
 def resolve(self, item, captcha_cb=None, select_cb=None):
     result = []
     item = item.copy()
     url = self._url(item['url'])
     data = util.substr(util.request(url), '<div id="content">', '<div id="sidebar">')
     embed_m = re.search('<embed.+?/>', data, re.DOTALL)
     iframe_m = re.search('<iframe.+?/>', data, re.DOTALL)
     resolve_data = ""
     if embed_m:
         resolve_data += embed_m.group()
     if iframe_m:
         resolve_data += iframe_m.group()
     resolve_data = re.sub('youtu.be/','www.youtube.com/watch?v=', resolve_data)
     resolved = resolver.findstreams(resolve_data, ['file=.*?(?P<url>http[^&]+)&','<iframe(.+?)src=[\"\'](?P<url>.+?)[\'\"]'])
     subs_m = re.search('captions\.file=([^&]+)', resolve_data, re.DOTALL)
     if resolved and subs_m:
         for i in resolved:
             i['subs'] = self._url(subs_m.group(1))
     if not resolved:
         raise ResolveException('Video nenalezeno')
     for i in resolved:
         item = self.video_item()
         item['title'] = i['title']
         item['url'] = i['url']
         item['quality'] = i['quality']
         item['surl'] = i['surl']
         item['subs'] = i['subs']
         item['headers'] = i['headers']
         try:
             item['fmt'] = i['fmt']
         except KeyError:
             pass
         result.append(item)
     if len(result)  == 0:
         return result[0]
     return select_cb(result)