Example #1
0
    def sendToPyLoad(self, siteResult = False):
        from resources.lib.handler.pyLoadHandler import cPyLoadHandler
        import urlresolver
        params = ParameterHandler()

        sMediaUrl = params.getValue('sMediaUrl')
        sFileName = params.getValue('MovieTitle')
        if not sFileName:
            sFileName = params.getValue('Title')
        if not sFileName: #nur vorrübergehend
            sFileName = params.getValue('sMovieTitle')
        if not sFileName:
            sFileName = params.getValue('title')

        if siteResult:
            sMediaUrl = siteResult['streamUrl']
            if siteResult['resolved']:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)   
        try:
            msg = sLink.msg
        except:
            msg = False
        if sLink != False and not msg:
            logger.info('download with pyLoad: ' + sMediaUrl)
            cPyLoadHandler().sendToPyLoad(sFileName,sLink)
            return True
        else:
            cGui().showError('xStream', str(msg), 5)
            return False
    def download(self, siteResult=False):
        from resources.lib.download import cDownload
        import urlresolver

        # oGui = cGui()
        params = ParameterHandler()

        sMediaUrl = params.getValue("sMediaUrl")
        sFileName = params.getValue("sFileName")
        sFileName = params.getValue("sMovieTitle")
        if siteResult:
            sMediaUrl = siteResult["streamUrl"]
            if siteResult["resolved"]:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info("call download: " + sMediaUrl)
        logger.info("file link: " + str(sLink))
        if self.dialog:
            self.dialog.close()
        if sLink != False:
            oDownload = cDownload()
            oDownload.download(sLink, "Stream")
        else:
            # cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
            return False
        return True
Example #3
0
    def _getInfoAndResolve(self, siteResult):
        import urlresolver
        oGui = cGui()
        params = ParameterHandler()
        # get data
        data = {}
        mediaUrl = params.getValue('sMediaUrl')
        fileName = params.getValue('MovieTitle')
        if not fileName:
            fileName = params.getValue('Title')
        if not fileName: #only temporary
            fileName = params.getValue('sMovieTitle')
        if not fileName:
            fileName = params.getValue('title')

        data['title'] = fileName
        data['season'] = params.getValue('season')
        data['episode'] = params.getValue('episode')
        data['showTitle'] = params.getValue('TVShowTitle')
        data['thumb'] = params.getValue('thumb')
        # resolve
        if siteResult:
            mediaUrl = siteResult['streamUrl']
            logger.info('resolve: ' + mediaUrl)
            if siteResult['resolved']:
                link = mediaUrl
            else:
                link = urlresolver.resolve(mediaUrl)
        elif mediaUrl:
            logger.info('resolve: ' + mediaUrl)
            link = urlresolver.resolve(mediaUrl)
        else:
            oGui.showError('xStream', 'kein Hosterlink übergeben', 5)
            return False
        #resolver response
        if hasattr(link, 'msg'):
            msg = link.msg
        else: msg = False
        if link != False and not msg:
            data['link'] = link
            return data
        # error during resolving
        if not msg:
            msg = 'Stream nicht mehr verfügbar oder Link fehlerhaft'
            oGui.showError('xStream',str(msg),7)
        if hasattr(link, 'code'):
            logger.info(str(msg) +' UnresolveableCode: '+ str(link.code))
        else:
            logger.info(str(msg) +' UnresolveableCode: - ')
        '''
            UnresolveableCode
            0: Unknown Error
            1: The url was resolved, but the file has been permanantly
                removed
            2: The file is temporarily unavailable for example due to
                planned site maintenance
            3. There was an error contacting the site for example a
                connection attempt timed out
        '''
        return False
Example #4
0
    def download(self, siteResult = False):
        #oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')
        sFileName = oInputParameterHandler.getValue('sMovieTitle')
        if siteResult:
            sMediaUrl = siteResult['streamUrl']
            if siteResult['resolved']:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info('call download: ' + sMediaUrl)
        logger.info('file link: ' + str(sLink))
        if self.dialog:
            self.dialog.close()
        if (sLink != False):
            oDownload = cDownload()
            oDownload.download(sLink, 'Stream')
        else:
            cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
            return False
        return True
Example #5
0
def resolve(url):

		html = client.request(url)
		links = re.findall('id=[\"\']([^\"\']+)[\"\']><a href=[\"\']#\d+[\"\']><div.+?>([^<]+)<',html)
		if len(links)<2:
			urls = re.findall('<iframe.+?src=[\'"](.+?)[\'"]',html)
			import urlresolver
			for url in urls:
				resolved = urlresolver.resolve(url)
				if resolved:
					return resolved
					break	
		else:
			import requests
			choices = [x[1] for x in links]
			i = control.selectDialog(choices,heading='Choose a link:')
			ref = url
			headers = {'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8','X-Requested-With':'XMLHttpRequest','Referer':ref, 'Origin':'http://fullmatchtv.com', 'Host':'fullmatchtv.com'}
			s = requests.Session()

			

			acp_pid = re.findall("id=[\"\']acp_post[\"\'].+?value=[\"\'](\d+)[\"\']",html)[0]
			post_data = {'acp_currpage' : int(i)+1,
						'acp_pid' : acp_pid,
						'acp_shortcode' : 'acp_shortcode',
						'action' : 'pp_with_ajax' 
						}
			result = s.post('http://fullmatchtv.com/wp-admin/admin-ajax.php', data=post_data, headers=headers).content
			url = re.findall('<iframe.+?src=[\'"](.+?)[\'"]',result)[0]
			import urlresolver
			return urlresolver.resolve(url)
Example #6
0
def play(url):
    if url.find('linkOut') != -1:
        urlout = url.split('?id=')[-1]
        url = base64.b64decode(urlout)
        plugin.notify(msg=urlout, title=url)
    resolved = ''
    stream_url = ''
    item = None
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        if not resolved or resolved == False or len(resolved) < 1:
            resolved = urlresolver.resolve(url)
            if resolved is None or len(resolved) < 1:
                resolved = urlresolver.resolve(urllib.unquote(url))
        if len(resolved) > 1:
            plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            plugin.play_video(item)
            return None
    except:
        resolved = ''
        plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
    try:
        import YDStreamExtractor
        info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
        resolved = info.streamURL()
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
            except:
                pass
        if len(stream_url) > 1:
            resolved = stream_url
        if len(resolved) > 1:
            plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            plugin.play_video(item)
            return None
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        plugin.play_video(item)
        return None
    else:
        plugin.set_resolved_url(url)
        plugin.play_video(url)
        return None
Example #7
0
def VIDEOLINKS(url,name):
        name = name.replace('[COLOR green]Lektor','')
        name = name.replace('[COLOR orange]Napisy','')
        name = name.replace('[/COLOR]','')
        link = getHtml (url)
        soup = BeautifulSoup(link, 'html.parser')
        divTag = soup.find_all("a" ,{"class":"watch"})
        print divTag
        for tag in divTag:
             #match=re.compile('<a class="watch" data-iframe="(.+?)" data-short="(.+?)" data-size="width: (.+?)px; height: (.+?)px;" data-urlhost="(.+?)" data-version="(.+?)" href="#!">Og').findall(str(tag))
             match=re.compile('<a class="watch" data-iframe="(.+?)" data-short="(.+?)" data-size="width: (.+?)px; height: (.+?)px;" data-urlhost="(.+?)" data-version="(.+?)"').findall(str(tag))
             for cos,lang_short,x,y,url,lang in match: 
                 print url + " linki"
                 match= re.compile('(http|https):\/\/(.+?)\/').findall(url)
                 for cos ,host in match:
                     host = host.replace('embed.','')
                     host = host.replace('www.','')
                     if "openload" in host:
                          #print "cosco " + host
                          ref = url.replace('video/','f/')
                          ref = ref.replace('http://','https://')
                          media_url = url.replace("http://openload.co/video/","https://openload.co/f/")
                          img_source = utils.getHtml(media_url, '', utils.openloadhdr)
                          match = re.compile('<meta name="og:image" content="(.+?)">').findall(img_source)
                          try:
                               poster_url = match[0]
                          except Exception:
                               pass
                          media_url = utils.playvideo(media_url, 'name', '', '')
                          media_url = media_url+'|User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0&Referer='+ref
                          print media_url + ' referer'
                          #media_url = urlresolver.resolve(media_url)
                          #poster_url = 'http://alltube.tv/static/host/play.png'
                          print media_url
                     elif "cda" in host:
                         media_url, poster_url = CDA(url)
                         if media_url:
                              #media_url = media_url+'|referer=http://static.cda.pl/flowplayer/flash/flowplayer.commercial-3.2.18.swf'
                              media_url = media_url+'|Cookie=PHPSESSID=1&Referer=http://static.cda.pl/flowplayer/flash/flowplayer.commercial-3.2.18.swf'
                              print media_url
                     elif "streamin" in host:
                          media_url = url.replace("video/","")
                          media_url = urlresolver.resolve(media_url)
                          poster_url = 'http://alltube.tv/static/host/play.png'
                     elif "vidto" in host:
                          media_url = url.replace("/v/","/")
                          media_url = urlresolver.resolve(media_url)
                          poster_url = 'http://alltube.tv/static/host/play.png'
                     else:                  
                         media_url = urlresolver.resolve(url)
                         poster_url = 'http://alltube.tv/static/host/play.png'
                 if media_url:
                      print media_url + " xxx"
                      #print lang
                 if media_url:
                      addLink(name+'[COLOR blue] '+lang+'[/COLOR]( '+host+' )',media_url,poster_url)
Example #8
0
def PLAYEP(name,url,iconimage):
        if urlresolver.HostedMediaFile(url).valid_url():
                stream_url = urlresolver.resolve(url)
        else:
                link = open_url(url)
                match=re.compile('src="(.+?)"></iframe>').findall(link)[0]
                stream_url = urlresolver.resolve(match)
        liz = xbmcgui.ListItem(name, iconImage='DefaultVideo.png', thumbnailImage=iconimage)
        liz.setPath(stream_url)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
Example #9
0
def play(url):
    resolved = ''
    stream_url = ''
    item = None
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        if not resolved or resolved == False or len(resolved) < 1:
            resolved = urlresolver.resolve(url)
            if resolved is None or len(resolved) < 1:
                resolved = urlresolver.resolve(urllib.unquote(url))
        if len(resolved) > 1:
            plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        resolved = ''
        plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
    try:
        import YDStreamExtractor
        info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
        resolved = info.streamURL()
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
            except:
                pass
        if len(stream_url) > 1:
            resolved = stream_url
        if len(resolved) > 1:
            plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)

    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        return item
    else:
        plugin.set_resolved_url(url) #url)
        #plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url))
        #item = ListItem.from_dict(path=plugurl)
        #item.add_stream_info('video', stream_values={})
        #item.set_is_playable(True)
        #plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000)
        return None
Example #10
0
def play(url):
    if plugin.get_setting('debugon', converter=bool): web_pdb.set_trace()

    resolved = ''
    stream_url = ''
    item = None
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        if not resolved or resolved == False or len(resolved) < 1:
            resolved = urlresolver.resolve(url)
            if resolved is None or len(resolved) < 1:
                resolved = urlresolver.resolve(WebUtils.unescape(url))
        if len(resolved) > 1:
            plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        resolved = ''
        plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
    try:
        import YDStreamExtractor
        info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
        resolved = info.streamURL()
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
            except:
                pass
        if len(stream_url) > 1:
            resolved = stream_url
        if len(resolved) > 1:
            plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)

    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        return item
    else:
        plugin.set_resolved_url(url)  # url)
        return None
Example #11
0
    def addToPlaylist(self, siteResult=False):
        import urlresolver

        oGui = cGui()
        params = ParameterHandler()

        sMediaUrl = params.getValue("sMediaUrl")
        sFileName = params.getValue("MovieTitle")
        if not sFileName:
            sFileName = params.getValue("title")
        if not sFileName:
            sFileName = params.getValue("Title")
        if not sFileName:  # nur vorrübergehend
            sFileName = params.getValue("sMovieTitle")
        if not sFileName:
            sFileName = params.getValue("title")
        sSeason = params.getValue("season")
        sEpisode = params.getValue("episode")
        sShowTitle = params.getValue("TvShowTitle")
        sThumbnail = params.getValue("thumb")
        if siteResult:
            sMediaUrl = siteResult["streamUrl"]
            if siteResult["resolved"]:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info("call addToPlaylist: " + sMediaUrl)
        logger.info("file link: " + str(sLink))
        if sLink != False:
            oGuiElement = cGuiElement()
            oGuiElement.setSiteName(self.SITE_NAME)
            oGuiElement.setMediaUrl(sLink)
            oGuiElement.setTitle(sFileName)
            if sThumbnail:
                oGuiElement.setThumbnail(sThumbnail)
            if sShowTitle:
                oGuiElement.addItemProperties("Episode", sEpisode)
                oGuiElement.addItemProperties("Season", sSeason)
                oGuiElement.addItemProperties("TvShowTitle", sShowTitle)
            if self.dialog:
                self.dialog.close()
            oPlayer = cPlayer()
            oPlayer.addItemToPlaylist(oGuiElement)
            oGui.showInfo("Playlist", "Stream wurde hinzugefügt", 5)
        else:
            # oGui.showError('Playlist', 'File deleted or Link could not be resolved', 5);
            return False
        return True
def PLAY(url,name):
    html = net().http_GET(url).content
    link=re.compile('<iframe width=.+?src="(.+?)".+?<',re.DOTALL).findall(html)
    if not link: link = re.compile('<a target="_blank" href="(.+?)"><img border=0').findall(html)
    if not link: link = re.compile("src='(.+?)'").findall(html)
    if not link: link = re.compile('<div id="emptydiv"><iframe src="(.+?)"',re.DOTALL).findall(html)
    if not link: link = re.compile('scrolling="no" src="(.+?)">').findall(html)
    print link[0]
    if name.strip() == 'VIDEOWEED': stream=urlresolver.resolve(link[0].replace('file','video'))
    else: stream=urlresolver.resolve(link[0])
    liz=xbmcgui.ListItem(label = name,label2 = name, iconImage="%s/art/video.png"%local.getAddonInfo("path"), thumbnailImage = "%s/art/video.png"%local.getAddonInfo("path") )
    liz.setInfo( type="Video", infoLabels = {'title' : name}); liz.setProperty('fanart_image', fanart)
    liz.setProperty('IsPlayable', 'true'); addon.resolve_url(stream)
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=stream,listitem=liz)
Example #13
0
    def addToPlaylist(self, siteResult = False):
        import urlresolver
        oGui = cGui()
        params = ParameterHandler()

        sMediaUrl = params.getValue('sMediaUrl')
        sFileName = params.getValue('MovieTitle')
        if not sFileName:
            sFileName = params.getValue('title')
        if not sFileName:
            sFileName = params.getValue('Title')
        if not sFileName: #nur vorrübergehend
            sFileName = params.getValue('sMovieTitle')
        if not sFileName:
            sFileName = params.getValue('title')
        sSeason = params.getValue('season')
        sEpisode = params.getValue('episode')
        sShowTitle = params.getValue('TvShowTitle')
        sThumbnail = params.getValue('thumb')
        if siteResult:
            sMediaUrl = siteResult['streamUrl']
            if siteResult['resolved']:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info('call addToPlaylist: ' + sMediaUrl)
        logger.info('file link: ' + str(sLink))
        if (sLink != False):
            oGuiElement = cGuiElement()
            oGuiElement.setSiteName(self.SITE_NAME)
            oGuiElement.setMediaUrl(sLink)
            oGuiElement.setTitle(sFileName)
            if sThumbnail:
                oGuiElement.setThumbnail(sThumbnail)
            if sShowTitle:
                oGuiElement.addItemProperties('Episode',sEpisode)
                oGuiElement.addItemProperties('Season',sSeason)
                oGuiElement.addItemProperties('TvShowTitle',sShowTitle)
            if self.dialog:
                self.dialog.close()
            oPlayer = cPlayer()
            oPlayer.addItemToPlaylist(oGuiElement)
            oGui.showInfo('Playlist', 'Stream wurde hinzugefügt', 5);
        else:
            #oGui.showError('Playlist', 'File deleted or Link could not be resolved', 5);
            return False
        return True
Example #14
0
def request(url):
    try:
        if '</regex>' in url:
            import regex ; url = regex.resolve(url)

        rd = realdebrid.resolve(url)
        if not rd == None: return rd
        pz = premiumize.resolve(url)
        if not pz == None: return pz

        if url.startswith('rtmp'):
            if len(re.compile('\s*timeout=(\d*)').findall(url)) == 0: url += ' timeout=10'
            return url

        u = urlparse.urlparse(url).netloc
        u = u.replace('www.', '').replace('embed.', '').replace('config.','')
        u = u.lower()

        r = [i['class'] for i in info() if u in i['netloc']][0]
        r = __import__(r, globals(), locals(), [], -1)
        r = r.resolve(url)

        if r == None:
            import urlresolver
            r = urlresolver.resolve(url)
            if not r:
                r = None

        if r == None: return r
        elif type(r) == list: return r
        elif not r.startswith('http'): return r

        try: h = dict(urlparse.parse_qsl(r.rsplit('|', 1)[1]))
        except: h = dict('')

        if not 'User-Agent' in h: h['User-Agent'] = client.agent()
        if not 'Referer' in h: h['Referer'] = url

        r = '%s|%s' % (r.split('|')[0], urllib.urlencode(h))
        return r
    except:
        try :
            import urlresolver
            r = urlresolver.resolve(url)
            if not r :
                url = r
        except:
            pass
        return url
Example #15
0
File: main.py Project: bialagary/mw
def RESOLVETVDL(name, url, thumb):

    data = 0
    try:
        data = GRABMETA(movie_name, year)
    except:
        data = 0
    hmf = urlresolver.HostedMediaFile(url)
    host = ""
    if hmf:
        url = urlresolver.resolve(url)
        host = hmf.get_host()
        if ".mp4" in url:
            ext = ".mp4"
        elif ".flv" in url:
            ext = ".flv"
        elif ".avi" in url:
            ext = ".avi"
        if not ext == "":

            console = "Downloads/TV Shows/" + dlfoldername
            params = {"url": url, "name": name, "thumb": thumb, "dlfoldername": dlfoldername}

            xbmc.sleep(1000)

            addToQueue(name, url, thumb, ext, console)
Example #16
0
def PLAYMEDIA(name,url):
    ok = True
    r = re.findall(r'(.+?)\[COLOR', name)
    name = r[0]
    r=re.findall('Season(.+?)Episode([^<]+)',name)
    if r:
        infoLabels =main.GETMETAEpiT(name,'','')
        video_type='episode'
        season=infoLabels['season']
        episode=infoLabels['episode']
    else:
        infoLabels =main.GETMETAT(name,'','','')
        video_type='movie'
        season=''
        episode=''
    img=infoLabels['cover_url']
    fanart =infoLabels['backdrop_url']
    imdb_id=infoLabels['imdb_id']
    infolabels = { 'supports_meta' : 'true', 'video_type':video_type, 'name':str(infoLabels['title']), 'imdb_id':str(infoLabels['imdb_id']), 'season':str(season), 'episode':str(episode), 'year':str(infoLabels['year']) }
    try:
        stream_url = urlresolver.resolve(url)
        infoL={'Title': infoLabels['title'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre']}
        # play with bookmark
        player = playbackengine.PlayWithoutQueueSupport(resolved_url=stream_url, addon_id=addon_id, video_type=video_type, title=str(infoLabels['title']),season=str(season), episode=str(episode), year=str(infoLabels['year']),img=img,infolabels=infoL, watchedCallbackwithParams=main.WatchedCallbackwithParams,imdb_id=imdb_id)
        #WatchHistory
        if selfAddon.getSetting("whistory") == "true":
            wh.add_item(hname+' '+'[COLOR=FF67cc33]TvRelease[/COLOR]', sys.argv[0]+sys.argv[2], infolabels=infolabels, img=str(img), fanart=str(fanart), is_folder=False)
        player.KeepAlive()
        return ok
    except:
        return ok
Example #17
0
	def resolve(self,url):
		html=client.request(url)
		soup=webutils.bs(html)
		try:
			link=soup.find('iframe',{'frameborder':'0'})['src']
		except:    
			sd = re.findall('<source src="(.+?)" type=\'video/mp4\' data-res="360p">',html)[0]
			try:
				hd = re.findall('<source src="(.+?)" type=\'video/mp4\' data-res="720p">',html)[0]
			except:
				hd = sd
			return hd

		if 'http' not in link:
			link = 'http://nbahd.com' + link
		try:
			html = client.request(link)
			urls = re.findall('src="(.+?)" type="video/mp4"',html)
			try: url = urls[1]
			except: url = urls[0]
			return url
		except:
				try:
					import urlresolver
					resolved = urlresolver.resolve(link)
					return resolved
				except:
					return
Example #18
0
def setup_download(name,url,thumb,medias,movie_title):

    hmf = urlresolver.HostedMediaFile(url)
    host = ''
    if hmf:
        urls = urlresolver.resolve(url)

    else: urls = url

    if '.mp4' in urls:
            ext = '.mp4'
    elif '.flv' in urls:
            ext = '.flv'
    elif '.avi' in urls:
            ext = '.avi'

    elif '.mkv' in urls:
            ext = '.mkv'

    elif '.m3u8' in urls:
            ext = '.m3u8'

    else:
      ext = '.flv'

    if medias =='movies':
        media = 'Movies'
    elif medias == 'shows':
        media = 'TV Shows/'+movie_title+'/'

    xbmc.sleep(1000)
    add_to_queue(name,urls,thumb,ext,media)
Example #19
0
def getUnzipped(theurl, thedir, thename, generalid):
    """Args:
    * theurl: The URL where the zip can be downloaded
    * thedir: The directory where the zipfile should be saved into
    * thename: The complete filename of the zipfile
    
    Function:
        Retrieves the zipfile from the URL location given, using urlresolver.
        The function then unzips the file.

    WORKAROUND INCLUDED:
        xbmc.extract can't handle a comma in the filename ( up to v12: Frodo)
        The script will remove any comma's in the name of the filename
    """
    theoldname = thename
    name = os.path.join(thedir, thename)
    try:
        if not os.path.exists(thedir):
            os.makedirs(thedir)
    except Exception:
        buggalo.onExceptionRaised()
        #buggalo.onExceptionRaised(thedir)
        print 'can\'t create directory (' + thedir + ')'
        return
    #try:
    print theurl[0:25]
    if urlresolver.HostedMediaFile(theurl).valid_url() or theurl[0:25] == "http://www.mediafire.com/":
    
        try:
            if theurl[0:25] == "http://www.mediafire.com/":
                url = theurl
            else:
                url = urlresolver.resolve(theurl)
            print 'translated link: ' + url
            if download_karaoke_file(url, name, name):
                # Code to circumvent a bug in URIUtils::HasExtension
                thenewname = theoldname.replace(",", "")
                if thenewname != theoldname:
                    newname = os.path.join(thedir, thenewname)
                    os.rename(name, newname)
                    name = newname

                # Python unzip is rubbish!!! gave me corrupted unzips every time
                xbmc.executebuiltin('xbmc.extract(' + name + ')', True)

                # Remove the zip file
                os.unlink(name)
                return 1
            else:
                reportFile('brokenlink', generalid, thename, theurl);
                xbmcgui.Dialog().ok(__addonname__, __language__(70120), __language__(70121), '')
                return 0
        except:
            xbmcgui.Dialog().ok(__addonname__, __language__(70126), __language__(70127), __language__(70121))
            return 0
    else:
        reportFile('brokenlink', generalid, thename, theurl);
        xbmcgui.Dialog().ok(__addonname__, __language__(70122), __language__(70121), '')
        return 0
    return 0
Example #20
0
def VIDEOLINKS(url,name):
        req = urllib2.Request(url)
        br =  mechanize.Browser()
        br.open(url)
        response1 = br.follow_link(url_regex = "http://www.video44.net")
        newurl = br.geturl()
        
        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()
        match=re.compile('src="(.+?)"').findall(link)

        print match
        for url in match:
                if "videoweed.es" in 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()
                        match=re.compile('flashvars.advURL="(.+?)"').findall(link)
                        try:
                                addLink('Videoweed',urlresolver.resolve(match[0]),artwork + 'vidweed.png')
                        except:
                                continue

        if "video44.net" in newurl:
                req = urllib2.Request(newurl)
                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()
                match=re.compile(' file: "(.+?)"').findall(link)
                addLink('Video44',match[0],artwork + 'video44.png')
Example #21
0
def PORNRESOLVE(name,url,thumb):
   try:        
     meta = 0
     hmf = urlresolver.HostedMediaFile(url)
     host = ''
     if hmf:
          url = urlresolver.resolve(url)
          host = hmf.get_host()
     
             
     params = {'url':url, 'name':name, 'thumb':thumb}
     if meta == 0:
          addon.add_video_item(params, {'title':name}, img=thumb)
          liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=thumb)

     else:
          addon.add_video_item(params, {'title':name}, img=meta['cover_url'])
          liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=meta['cover_url'])
          liz.setInfo('video',infoLabels=meta)

     xbmc.sleep(1000)
        
     xbmc.Player ().play(url, liz, False)
   except Exception:
        buggalo.onExceptionRaised()     
def RESOLVETVDL(name,url,thumb):
         
     data=0
     try:
          data = GRABMETA(movie_name,year)
     except:
           data=0
     hmf = urlresolver.HostedMediaFile(url)
     host = ''
     if hmf:
          url = urlresolver.resolve(url)
          host = hmf.get_host()
          if '.mp4' in url:
                    ext = '.mp4'
          elif '.flv' in url:
                    ext = '.flv'
          elif '.avi' in url:
                    ext = '.avi'
          if not ext == '':
          
               console = 'Downloads/TV Shows/'+ dlfoldername
               params = {'url':url, 'name':name, 'thumb':thumb, 'dlfoldername':dlfoldername} 
     
               xbmc.sleep(1000)
        
               addToQueue(name,url,thumb,ext,console)
    def get(self, url):
        try:
            debrid = self.realdebrid(url)
            if not debrid == None: return debrid

            if '/vk.com' in url:                url = self.vk(url)
            elif 'mail.ru' in url:              url = self.mailru(url)
            elif 'videomega.tv' in url:         url = self.videomega(url)
            elif 'docs.google.com' in url:      url = self.googledocs(url)
            elif 'picasaweb.google.com' in url: url = self.picasaweb(url)
            elif 'youtube.com' in url:          url = self.youtube(url)
            elif 'ishared.eu' in url:           url = self.ishared(url)
            elif 'firedrive.com' in url:        url = self.firedrive(url)
            elif 'putlocker.com' in url:        url = self.firedrive(url)
            elif 'movreel.com' in url:          url = self.movreel(url)
            elif 'billionuploads.com' in url:   url = self.billionuploads(url)
            elif '180upload.com' in url:        url = self._180upload(url)
            elif 'hugefiles.net' in url:        url = self.hugefiles(url)

            else:
                import urlresolver
                host = urlresolver.HostedMediaFile(url)
                if host: resolver = urlresolver.resolve(url)
                else: return url
                if not resolver.startswith('http://'): return
                if not resolver == url: return resolver

            return url
        except:
            return
Example #24
0
def ResolverLink(url):
        url=urllib.unquote_plus(url)
        url = urlresolver.resolve(url)
        listitem = xbmcgui.ListItem(name, iconImage='', thumbnailImage='')
        url=urllib.unquote_plus(url)
        listitem.setPath(url)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
Example #25
0
def playURLRVideo(url, name, type_):
    dialog_progress_title='URL Resolver'
    dialog_progress_YTDL = xbmcgui.DialogProgressBG()
    dialog_progress_YTDL.create(dialog_progress_title )
    dialog_progress_YTDL.update(10,dialog_progress_title,translation(32014)  )

    from urlparse import urlparse
    parsed_uri = urlparse( url )
    domain = '{uri.netloc}'.format(uri=parsed_uri)
    try:
        import urlresolver
        #hmf = urlresolver.HostedMediaFile(url)
        dialog_progress_YTDL.update(20,dialog_progress_title,translation(32012)  )

        media_url = urlresolver.resolve(url)
        dialog_progress_YTDL.update(80,dialog_progress_title,translation(32013)  )
        if media_url:
            log( '  URLResolver stream url=' + repr(media_url ))

            pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            pl.clear()
            pl.add(media_url, xbmcgui.ListItem(name))
            xbmc.Player().play(pl, windowed=False)  #scripts play video like this.
        else:
            log( "  Can't URL Resolve:" + repr(url))
            xbmc_notify('URLresolver', translation(32192),icon="type_urlr.png" )  #Failed to get playable url
    except Exception as e:
        xbmc_notify('URLresolver:'+domain, str(e),icon="type_urlr.png" )
    dialog_progress_YTDL.close()
Example #26
0
File: main.py Project: nek0316/Repo
def RESOLVE2(name,url,thumb):
         
     #data=0
     #try:
     #data = GRABMETA(movie_name,year)
     #except:
     data=0
     #hmf = urlresolver.HostedMediaFile(url)
     #host = ''
     #if hmf:
     url = urlresolver.resolve(url)
          #host = hmf.get_host() 
             
     params = {'url':url, 'name':name, 'thumb':thumb}
     if data == 0:
          addon.add_video_item(params, {'title':name}, img=thumb)
          liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=thumb)

     else:
          addon.add_video_item(params, {'title':name}, img=data['cover_url'])
          liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=data['cover_url'])
          liz.setInfo('video',infoLabels=data)

     xbmc.sleep(1000)
        
     xbmc.Player ().play(url, liz, False)
    def video(self, elem):
        """Display the video

        :param elem: HTML tree element

        :returns:
        """
        video = {}
        current_provider = elem.find('a', {'href': '#tabs1-video'}).getText()

        embed_elem = elem.find('embed')
        iframe_elem = elem.find('iframe')

        if embed_elem:
            current_url = embed_elem.get('src')
        elif iframe_elem:
            current_url = iframe_elem.get('src')
        else:
            return video

        try:
            url = urlresolver.resolve(current_url)
            if url:
                video['label'] = current_provider
                video['url'] = url
        except:
            video['label'] = 'Dummy'
            video['url'] = 'http://s3.amazonaws.com/KA-youtube-converted/JwO_25S_eWE.mp4/JwO_25S_eWE.mp4'

        return video
Example #28
0
def RESOLVE(name,host,url):
        if 'epornik' in url:
                link = net.http_GET(url).content
                elink=re.compile('s1.addVariable(.+?);').findall(link)
                dirty = re.sub("[',)(]", '', (elink[5]))
                clean =   dirty[7:-1]
                url = clean
        else:
                url = urlresolver.resolve(url)
        meta = 0
        try:
             meta = getMeta(name,types)
        except:
             pass
        
        params = {'name':name, 'url':url, 'mode':mode, 'thumb':thumb, 'types':types, 'host':host}
        if meta == 0:
             addon.add_video_item(params, {'title':name}, img=thumb)
             liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.jpg", thumbnailImage=thumb)
        else:
             addon.add_video_item(params, meta, fanart=meta['backdrop_url'], img=meta['cover_url'])
             liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.jpg", thumbnailImage=meta['cover_url'])
             liz.setInfo('video',infoLabels=meta)
        
        xbmc.sleep(1000)
        
        xbmc.Player ().play(url, liz, False)
Example #29
0
	def resolve(self, url, resolver):
		if not self.started: self.start()
		u = None
		if 'plugin://' in url:
			if url.startswith('plugin://'):
				u = url
			elif url.startswith('['):
				argv = url[1:-1].split(' , ')
				u = (argv[1] if len(argv) > 1 and argv[1].startswith('plugin://') else None)
		else:
			u = urlresolver.resolve(url)
		if u:
			if 'plugin://' in u:
				pmsaddItem = __builtin__.pms.addItem
				pmsutil = __builtin__.pms.util
				def addItem(itemtype, name, argv, thumb=None, mediainfo=None, data=None):
					if type(argv).__name__ == 'list':
						argv = jumpy.flatten(argv)
					resolver.add(argv, name, thumb)
				__builtin__.pms.addItem = addItem
				def util(action, arg1=None, arg2=None):
					if action == PMS_SUBTITLE:
						resolver.sub = arg1.strip()
						return ''
					else:
						return pmsutil(action, arg1, arg2)
				__builtin__.pms.util = util
				xbmcinit.run_addon(u)
				__builtin__.pms.addItem = pmsaddItem
				__builtin__.pms.util = pmsutil
			else:
				resolver.add(u)
Example #30
0
def PLAY(name,url):
    ok=True
    hname=name
    name  = name.split('[COLOR blue]')[0]
    name  = name.split('[COLOR red]')[0]
    infoLabels = main.GETMETAT(name,'','','')
    video_type='movie'
    season=''
    episode=''
    img=infoLabels['cover_url']
    fanart =infoLabels['backdrop_url']
    imdb_id=infoLabels['imdb_id']
    infolabels = { 'supports_meta' : 'true', 'video_type':video_type, 'name':str(infoLabels['title']), 'imdb_id':str(infoLabels['imdb_id']), 'season':str(season), 'episode':str(episode), 'year':str(infoLabels['year']) }

    try:
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
        stream_url = urlresolver.resolve(url)

        infoL={'Title': infoLabels['metaName'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre']}
        from resources.universal import playbackengine
        player = playbackengine.PlayWithoutQueueSupport(resolved_url=stream_url, addon_id=addon_id, video_type=video_type, title=str(infoLabels['title']),season=str(season), episode=str(episode), year=str(infoLabels['year']),img=img,infolabels=infoL, watchedCallbackwithParams=main.WatchedCallbackwithParams,imdb_id=imdb_id)
        player.KeepAlive()
        return ok
    except Exception, e:
        if stream_url != False:
                main.ErrorReport(e)
        return ok
Example #31
0
def parseUrl():
    import urlparse
    netloc = [urlparse.urlparse(sys.argv[0]).netloc, '']
    #if xbmc.getInfoLabel('Container.PluginName') not in netloc:
    #    sys.exit()
    #    return

    params = ParameterHandler()
    logger.info(params.getAllParameters())
    # If no function is set, we set it to the default "load" function
    if params.exist('function'):
        sFunction = params.getValue('function')
        if sFunction == 'spacer':
            return True
        elif sFunction == 'clearCache':
            from resources.lib.handler.requestHandler import cRequestHandler
            cRequestHandler('dummy').clearCache()
            return
        elif sFunction == 'changeWatched':
            changeWatched(params)
            return
        elif sFunction == 'updateMeta':
            updateMeta(params)
            return
        elif sFunction == 'searchAlter':
            searchAlter(params)
            return
        elif sFunction == 'updateXstream':
            from resources.lib import updateManager
            updateManager.xStreamUpdate()
            return
        elif sFunction == 'updateUrlResolver':
            from resources.lib import updateManager
            updateManager.urlResolverUpdate()
            return
        elif sFunction == 'updateAll':
            from resources.lib import updateManager
            updateManager.xStreamUpdate()
            updateManager.urlResolverUpdate()
            return
    elif params.exist('remoteplayurl'):
        try:
            import urlresolver
            remotePlayUrl = params.getValue('remoteplayurl')
            sLink = urlresolver.resolve(remotePlayUrl)
            if sLink:
                xbmc.executebuiltin("PlayMedia(" + sLink + ")")
            else:
                logger.info("Could not play remote url '%s'" % sLink)
        except urlresolver.resolver.ResolverError as e:
            logger.info('ResolverError: %s' % e)
        return
    else:
        sFunction = 'load'

    # Test if we should run a function on a special site
    if not params.exist('site'):
        xbmc.executebuiltin('XBMC.RunPlugin(%s?function=clearCache)' % sys.argv[0])

        xStreamUpdate = True if cConfig().getSetting('githubUpdateXstream') == 'true' else False
        urlResolverUpdate = True if cConfig().getSetting('githubUpdateUrlResolver') == 'true' else False

        if xStreamUpdate and urlResolverUpdate:
            xbmc.executebuiltin('XBMC.RunPlugin(%s?function=updateAll)' % sys.argv[0])
        elif xStreamUpdate:
            xbmc.executebuiltin('XBMC.RunPlugin(%s?function=updateXstream)' % sys.argv[0])
        elif urlResolverUpdate:
            xbmc.executebuiltin('XBMC.RunPlugin(%s?function=updateUrlResolver)' % sys.argv[0])
        # As a default if no site was specified, we run the default starting gui with all plugins
        showMainMenu(sFunction)
        return
    sSiteName = params.getValue('site')
    if params.exist('playMode'):
        from resources.lib.gui.hoster import cHosterGui
        url = False
        playMode = params.getValue('playMode')
        isHoster = params.getValue('isHoster')
        url = params.getValue('url')
        manual = params.exist('manual')
        if cConfig().getSetting(
                'hosterSelect') == 'Auto' and playMode != 'jd' and playMode != 'jd2' and playMode != 'pyload' and not manual:
            cHosterGui().streamAuto(playMode, sSiteName, sFunction)
        else:
            cHosterGui().stream(playMode, sSiteName, sFunction, url)
        return
    logger.info("Call function '%s' from '%s'" % (sFunction, sSiteName))
    # If the hoster gui is called, run the function on it and return
    if sSiteName == 'cHosterGui':
        showHosterGui(sFunction)
    # If global search is called
    elif sSiteName == 'globalSearch':
        searchterm = False
        if params.exist('searchterm'):
            searchterm = params.getValue('searchterm')

        searchGlobal(searchterm)
    elif sSiteName == 'favGui':
        showFavGui(sFunction)
    # If addon settings are called
    elif sSiteName == 'xStream':
        oGui = cGui()
        oGui.openSettings()
        oGui.updateDirectory()
    # If the urlresolver settings are called
    elif sSiteName == 'urlresolver':
        import urlresolver
        urlresolver.display_settings()
    # If metahandler settings are called
    elif sSiteName == 'metahandler':
        import metahandler
        metahandler.display_settings()
    elif sSiteName == 'settings':
        oGui = cGui()
        for folder in settingsGuiElements():
            oGui.addFolder(folder)
        oGui.setEndOfDirectory()
    else:
        # Else load any other site as plugin and run the function
        plugin = __import__(sSiteName, globals(), locals())
        function = getattr(plugin, sFunction)
        function()
Example #32
0
# -*- coding: utf-8 -*-
Example #33
0
def playYTDLVideoOLD(url, name, type_):
    #url = "http://www.youtube.com/watch?v=_yVv9dx88x0"   #a youtube ID will work as well and of course you could pass the url of another site

    #url='https://www.youtube.com/shared?ci=W8n3GMW5RCY'
    #url='http://burningcamel.com/video/waster-blonde-amateur-gets-f****d'
    #url='http://www.3sat.de/mediathek/?mode=play&obj=51264'
    #url='http://www.4tube.com/videos/209271/hurry-f**k-i-bored'
    #url='http://www.pbs.org/newshour/rundown/cubas-elian-gonzalez-now-college-graduate/'

    #these checks done in around May 2016
    #does not work:  yourlust  porntube xpornvid.com porndig.com  thumbzilla.com eporner.com yuvutu.com p**n.com pornerbros.com f*x.com flyflv.com xstigma.com sexu.com 5min.com alphaporno.com
    # stickyxtube.com xxxbunker.com bdsmstreak.com  jizzxman.com pornwebms.com pornurl.pw porness.tv openload.online pornworms.com fapgod.com porness.tv hvdporn.com pornmax.xyz xfig.net yobt.com
    # eroshare.com kalporn.com hdvideos.p**n dailygirlscute.com desianalporn.com indianxxxhd.com onlypron.com sherloxxx.com hdvideos.p**n x1xporn.com pornhvd.com lxxlx.com xrhub.com shooshtime.com
    # pornvil.com lxxlx.com redclip.xyz younow.com aniboom.com  gotporn.com  virtualtaboo.com 18porn.xyz vidshort.net fapxl.com vidmega.net freudbox.com bigtits.com xfapzap.com o****m.com
    # userporn.com hdpornstar.com moviesand.com chumleaf.com fucktube.com fookgle.com pornative.com dailee.com pornsharia.com f*x.com sluttyred.com pk5.net kuntfutube.com youpunish.com
    # vidxnet.com jizzbox.com bondagetube.tv spankingtube.tv pornheed.com pornwaiter.com lubetube.com porncor.com maxjizztube.com asianxtv.com analxtv.com yteenporn.com nurglestube.com yporn.tv
    # asiantubesex.com zuzandra.com moviesguy.com bustnow.com dirtydirtyangels.com yazum.com watchersweb.com voyeurweb.com zoig.com flingtube.com yourfreeporn.us foxgay.com goshgay.com
    # player.moviefap.com(www.moviefap.com works) nosvideo.com

    # also does not work (non p**n)
    # rutube.ru  mail.ru  afreeca.com nicovideo.jp  videos.sapo.pt(many but not all) sciencestage.com vidoosh.tv metacafe.com vzaar.com videojug.com trilulilu.ro tudou.com video.yahoo.com blinkx.com blip.tv
    # blogtv.com  brainpop.com crackle.com engagemedia.org expotv.com flickr.com fotki.com hulu.com lafango.com  mefeedia.com motionpictur.com izlesene.com sevenload.com patas.in myvideo.de
    # vbox7.com 1tv.ru 1up.com 220.ro 24video.xxx 3sat.de 56.com adultswim.com atresplayer.com techchannel.att.com v.baidu.com azubu.tv www.bbc.co.uk/iplayer bet.com biobiochile.cl biqle.com
    # bloomberg.com/news/videos bpb.de bravotv.com byutv.org cbc.ca chirbit.com cloudtime.to(almost) cloudyvideos.com cracked.com crackle.com criterion.com ctv.ca culturebox.francetvinfo.fr
    # cultureunplugged.com cwtv.com daum.net dctp.tv democracynow.org douyutv.com dumpert.nl eitb.tv ex.fm fc-zenit.ru  ikudonsubs.com akb48ma.com Flipagram.com ft.dk Formula1.com
    # fox.com/watch(few works) video.foxnews.com foxsports.com france2.fr franceculture.fr franceinter.fr francetv.fr/videos francetvinfo.fr giantbomb.com hbo.com History.com hitbox.tv
    # howcast.com HowStuffWorks.com hrt.hr iconosquare.com infoq.com  ivi.ru kamcord.com/v video.kankan.com karrierevideos.at KrasView.ru hlamer.ru kuwo.cn la7.it laola1.tv le.com
    # media.ccc.de metacritic.com mitele.es  moevideo.net,playreplay.net,videochart.net vidspot.net(might work, can't find recent post) movieclips.com mtv.de mtviggy.com muenchen.tv myspace.com
    # myvi.ru myvideo.de myvideo.ge 163.com netzkino.de nfb.ca nicovideo.jp  videohive.net normalboots.com nowness.com ntr.nl nrk.no ntv.ru/video ocw.mit.edu odnoklassniki.ru/video
    # onet.tv onionstudios.com/videos openload.co orf.at parliamentlive.tv pbs.org

    # news site (can't find sample to test)
    # bleacherreport.com crooksandliars.com DailyMail.com channel5.com Funimation.com gamersyde.com gamespot.com gazeta.pl helsinki.fi hotnewhiphop.com lemonde.fr mnet.com motorsport.com MSN.com
    # n-tv.de ndr.de NDTV.com NextMedia.com noz.de

    # these sites have mixed media. can handle the video in these sites:
    # 20min.ch 5min.com archive.org Allocine.fr(added) br.de bt.no  buzzfeed.com condenast.com firstpost.com gameinformer.com gputechconf.com heise.de HotStar.com(some play) lrt.lt natgeo.com
    # nbcsports.com  patreon.com
    # 9c9media.com(no posts)

    #ytdl plays this fine but no video?
    #coub.com

    #supported but is an audio only site
    #acast.com AudioBoom.com audiomack.com bandcamp.com clyp.it democracynow.org? freesound.org hark.com hearthis.at hypem.com libsyn.com mixcloud.com
    #Minhateca.com.br(direct mp3)

    #
    # ytdl also supports these sites:
    # myvideo.co.za  ?
    #bluegartr.com  (gif)
    # behindkink.com   (not sure)
    # facebook.com  (need to work capturing only videos)
    # features.aol.com  (inconsistent)
    # livestream.com (need to work capturing only videos)
    # mail.ru inconsistent(need to work capturing only videos)
    # miomio.tv(some play but most won't)
    # ooyala.com(some play but most won't)
    #

    #     extractors=[]
    #     from youtube_dl.extractor import gen_extractors
    #     for ie in gen_extractors():
    #         #extractors.append(ie.IE_NAME)
    #         try:
    #             log("[%s] %s " %(ie.IE_NAME, ie._VALID_URL) )
    #         except Exception as e:
    #             log( "zz   " + str(e) )

    #     extractors.sort()
    #     for n in extractors: log("'%s'," %n)
    from urlparse import urlparse
    parsed_uri = urlparse(url)
    domain = '{uri.netloc}'.format(uri=parsed_uri)

    dialog_progress_YTDL = xbmcgui.DialogProgressBG()
    dialog_progress_YTDL.create('YTDL')
    dialog_progress_YTDL.update(10, 'YTDL', 'Checking link...')

    try:
        from domains import ydtl_get_playable_url
        stream_url = ydtl_get_playable_url(url)
        if stream_url:
            dialog_progress_YTDL.update(80, 'YTDL', 'Playing')
            listitem = xbmcgui.ListItem(
                path=stream_url[0])  #plugins play video like this.
            xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
        else:
            dialog_progress_YTDL.update(40, 'YTDL', 'Trying URLResolver')
            log('YTDL Unable to get playable URL, Trying UrlResolver...')

            #ytdl seems better than urlresolver for getting the playable url...
            media_url = urlresolver.resolve(url)
            if media_url:
                dialog_progress_YTDL.update(88, 'YTDL', 'Playing')
                #log( '------------------------------------------------urlresolver stream url ' + repr(media_url ))
                listitem = xbmcgui.ListItem(path=media_url)
                xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
            else:
                log('UrlResolver cannot get a playable url')
                xbmc_notify(translation(30192), domain)

    except Exception as e:
        xbmc_notify("%s(YTDL)" % domain, str(e))
    finally:
        dialog_progress_YTDL.update(
            100, 'YTDL'
        )  #not sure if necessary to set to 100 before closing dialogprogressbg
        dialog_progress_YTDL.close()
def PLAYSTREAM(name,url,iconimage):
		if 'YOUTUBE' in name:
			link = str(url)
		elif 'VIDEA' in name:
			try:
				url=url.split('-')[1]
			except:
				url=url
			link = GrabVidea(url)
		elif 'VK.COM' in name:
			link = GrabVK(url)

		elif 'MAIL.RU' in name:
			link = GrabMailRu(url)

		elif 'RUTUBE' in name:
			try:
				html = 'http://rutube.ru/api/play/trackinfo/%s/?format=xml'% url.replace('_ru','')
				print html
				link = OPEN_URL(html)
				r = '<m3u8>(.+?)</m3u8>'
				match = re.compile(r,re.DOTALL).findall(link)
				if match:
					link=match[0]
				else:
					dialog = xbmcgui.Dialog()
					dialog.ok("Football Replays", '','Sorry Video Is Private', '')
					return
			except:
				dialog = xbmcgui.Dialog()
				dialog.ok("Football Replays", '','Sorry Video Is Private', '')
				return
		elif 'PLAYWIRE' in name:
			link = OPEN_URL(url)
			r = '<baseURL>(.+?)</baseURL>'
			base=  re.compile(r,re.DOTALL).findall(link)[0]
			h='media url="(.+?)"'
			files = re.compile(h,re.DOTALL).findall(link)[0]

			if base:
				link=base+'/'+files

		elif 'DAILYMOTION' in name:
			import urlresolver
			link = 'http://www.dailymotion.com/embed/video/'+url
			link=urlresolver.resolve(str(link))

		elif 'FOOTBALLFULLMATCH.COM' in name:
			link = OPEN_URL(url).replace("'",'"')
			r = '"file": "(.+?)"'
			link=  re.compile(r,re.DOTALL).findall(link)[0]

		else:
			import urlresolver
			link=urlresolver.resolve(str(url))
		try:
			liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
			liz.setInfo( type="Video", infoLabels={ "Title": name} )
			liz.setProperty("IsPlayable","true")
			liz.setPath(link)
			xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
		except:pass
Example #35
0
    def play(self, siteResult=False):
        import urlresolver
        oGui = cGui()
        params = ParameterHandler()
        sMediaUrl = params.getValue('sMediaUrl')
        sFileName = params.getValue('MovieTitle')
        if not sFileName:
            sFileName = params.getValue('Title')
        if not sFileName:  #nur vorrübergehend
            sFileName = params.getValue('sMovieTitle')
        if not sFileName:
            sFileName = params.getValue('title')

        sSeason = params.getValue('season')
        sEpisode = params.getValue('episode')
        sShowTitle = params.getValue('TvShowTitle')
        sThumbnail = params.getValue('thumb')

        if siteResult:
            sMediaUrl = siteResult['streamUrl']
            logger.info('call play: ' + sMediaUrl)
            if siteResult['resolved']:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)

        elif sMediaUrl:
            logger.info('call play: ' + sMediaUrl)
            sLink = urlresolver.resolve(sMediaUrl)
        else:
            oGui.showError('xStream', 'Hosterlink not found', 5)
            return False
        try:
            msg = sLink.msg
        except:
            msg = False
        if sLink != False and not msg:
            logger.info('file link: ' + str(sLink))
            oGuiElement = cGuiElement()
            oGuiElement.setSiteName(self.SITE_NAME)
            oGuiElement.setMediaUrl(sLink)
            oGuiElement.setTitle(sFileName)
            if sThumbnail:
                oGuiElement.setThumbnail(sThumbnail)
            if sShowTitle:
                oGuiElement.addItemProperties('Episode', sEpisode)
                oGuiElement.addItemProperties('Season', sSeason)
                oGuiElement.addItemProperties('TvShowTitle', sShowTitle)

            #listItem = xbmcgui.ListItem(path=sLink)
            #listItem.setInfo(type="Video", infoLabels='')
            #listItem.setProperty('IsPlayable', 'true')
            #pluginHandle = oGui.pluginHandle
            #xbmcplugin.setResolvedUrl(pluginHandle, True, listItem)

            oPlayer = cPlayer()
            oPlayer.clearPlayList()
            oPlayer.addItemToPlaylist(oGuiElement)
            if self.dialog:
                try:
                    self.dialog.close()
                except:
                    pass
            oPlayer.startPlayer()
            return True  #Necessary for autoStream
        else:
            logger.info('File link: ' + str(sLink))
            print str(msg)
            return False
Example #36
0
# -*- coding: utf-8 -*-
    def resolve(self, url):
        ref = url
        html = client.request(url)
        soup = webutils.bs(html)
        try:
            url = soup.find('iframe', {'width': '600'})['src']
        except:
            try:
                url = 'http:' + re.findall(
                    '(\/\/config\.playwire\.com\/[^\'\"]+)', html)[0]
            except:
                try:
                    url = soup.find('iframe', {'width': '626'})['src']
                except:
                    return

        if 'nba' in url:
            url = url.split("playlist=")[-1]
            url = 'http://video.nba.com/videocenter/servlets/playlist?ids=%s&format=json' % url
            result = client.request(url)
            url = re.compile('"publishPoint":"(.+?)"').findall(result)[0]
            return url
        elif 'rutube' in url:
            url = re.findall('embed/(\d+)', url)[0]
            url = 'http://rutube.ru/api/play/options/' + url + '?format=json'
            result = client.request(url)
            jsx = json.loads(result)
            link = jsx['video_balancer']['m3u8']
            return link
        elif 'youtube' in url:
            import liveresolver
            return liveresolver.resolve(url)
        elif 'playwire' in url:
            try:
                result = client.request(url)
                html = result
                result = json.loads(result)
                try:
                    f4m = result['content']['media']['f4m']
                except:
                    reg = re.compile('"src":"http://(.+?).f4m"')
                    f4m = re.findall(reg, html)[0]
                    f4m = 'http://' + pom + '.f4m'

                result = client.request(f4m)
                soup = webutils.bs(result)
                try:
                    base = soup.find('baseURL').getText() + '/'
                except:
                    base = soup.find('baseurl').getText() + '/'

                linklist = soup.findAll('media')
                choices, links = [], []
                for link in linklist:
                    url = base + link['url']
                    bitrate = link['bitrate']
                    choices.append(bitrate)
                    links.append(url)
                    if len(links) == 1:
                        return links[0]
                    if len(links) > 1:
                        import xbmcgui
                        dialog = xbmcgui.Dialog()
                        index = dialog.select('Select bitrate', choices)
                    if index > -1:
                        return links[index]
                return
            except:
                return

        elif 'mail.ru' in url:
            link = url

            link = link.replace(
                'https://videoapi.my.mail.ru/videos/embed/mail/',
                'http://videoapi.my.mail.ru/videos/mail/')
            link = link.replace(
                'http://videoapi.my.mail.ru/videos/embed/mail/',
                'http://videoapi.my.mail.ru/videos/mail/')
            link = link.replace('html', 'json')
            s = requests.Session()
            f = s.get(link).text

            js = json.loads(f)
            token = s.cookies.get_dict()['video_key']
            url = js['videos'][-1]['url'] + '|%s' % (urllib.urlencode(
                {
                    'Cookie': 'video_key=%s' % token,
                    'User-Agent': client.agent(),
                    'Referer': ref
                }))
            return url
        else:
            import urlresolver
            url = urlresolver.resolve(url)
            return url
Example #38
0
    def _getInfoAndResolve(self, siteResult):
        oGui = cGui()
        params = ParameterHandler()

        # get data
        mediaUrl = params.getValue('sMediaUrl')
        fileName = params.getValue('MovieTitle')
        if not fileName:
            fileName = params.getValue('Title')
        if not fileName:  # only temporary
            fileName = params.getValue('sMovieTitle')
        if not fileName:
            fileName = params.getValue('title')

        try:
            import urlresolver

            # resolve
            if siteResult:
                mediaUrl = siteResult.get('streamUrl', False)
                mediaId = siteResult.get('streamID', False)

                if mediaUrl:
                    logger.info('resolve: ' + mediaUrl)
                    link = mediaUrl if siteResult[
                        'resolved'] else urlresolver.resolve(mediaUrl)
                elif mediaId:
                    logger.info('resolve: hoster: %s - mediaID: %s' %
                                (siteResult['host'], mediaId))
                    link = urlresolver.HostedMediaFile(
                        host=siteResult['host'].lower(),
                        media_id=mediaId).resolve()
                else:
                    oGui.showError('streamon', 'kein Hosterlink übergeben', 5)
                    return False
            elif mediaUrl:
                logger.info('resolve: ' + mediaUrl)
                link = urlresolver.resolve(mediaUrl)
            else:
                oGui.showError('streamon', 'kein Hosterlink übergeben', 5)
                return False
        except urlresolver.resolver.ResolverError as e:
            logger.info('ResolverError: %s' % e)
            oGui.showError('streamon',
                           'Stream nicht mehr verfügbar oder Link fehlerhaft',
                           7)
            return False

        # resolver response
        if link is not False:
            data = {
                'title': fileName,
                'season': params.getValue('season'),
                'episode': params.getValue('episode'),
                'showTitle': params.getValue('TVShowTitle'),
                'thumb': params.getValue('thumb'),
                'link': link
            }
            return data

        return False
def __extract_with_urlresolver(url, content):
    # NOTE: Requires urlresolver dependancy (script.module.urlresolver) in
    # addon.xml

    import urlresolver
    return lambda: urlresolver.resolve(url)
Example #40
0
def download_epizodu(title, url):
    try:
        soup = get_soup(url)
        tag = soup.find('div', {'id': 'Playerholder'})
        frames = tag.findAll('iframe')
        if len(frames) > 1:
            sources = []
            for i in range(len(frames)):
                sources += ['%s. dio' % (i + 1)]
            dialog = xbmcgui.Dialog()
            index = dialog.select('Odaberite:', sources)
            li = xbmcgui.ListItem('%s' % title)
            li.setInfo('video', {'title': '%s' % title})
            if index > -1:
                link = frames[index]
                title = title + ' (%s od %s)' % (index + 1, len(frames))

                link = link['src']
                try:
                    from lib.resolvers import dailymotion
                    resolved = dailymotion.resolve(link)
                    resolved = resolved[0]['url']

                except:

                    try:
                        import urlresolver
                        resolved = urlresolver.resolve(link)
                    except:
                        try:
                            import YDStreamExtractor
                            YDStreamExtractor.disableDASHVideo(True)
                            vid = YDStreamExtractor.getVideoInfo(link,
                                                                 quality=1)
                            resolved = vid.streamURL()
                        except:
                            pass

                download(title, resolved)

                return
            else:
                return

    except:
        pass

    try:
        soup = get_soup(url)
        link = soup.findAll('iframe')[1]['src']

    except:

        try:
            soup = get_soup(url)
            link = soup.findAll('iframe')[1]['src']

        except:
            try:
                soup = get_soup(url)
                try:
                    link = soup.find('div', {
                        'id': 'Playerholder'
                    }).find('embed')['src']
                except:
                    link = soup.find('div', {
                        'id': 'Playerholder'
                    }).find('iframe')['src']

            except:
                html = read_url(url).lower()
                ind = html.index('player.src')
                html = html[ind:ind + 80]

                reg = r'watch\?v=(.+?)"'
                link = re.findall(re.compile(reg), html)[0]

                link = 'http://www.youtube.com/watch?v=' + link

    if 'moevideo' in link or 'playreplay' in link:
        import YDStreamExtractor
        YDStreamExtractor.disableDASHVideo(True)
        vid = YDStreamExtractor.getVideoInfo(link, quality=1)
        resolved = vid.streamURL()

    else:
        try:
            from lib.resolvers import dailymotion
            resolved = dailymotion.resolve(link)
            resolved = resolved[0]['url']

        except:

            try:
                import urlresolver
                resolved = urlresolver.resolve(link)
            except:
                try:
                    import YDStreamExtractor
                    YDStreamExtractor.disableDASHVideo(True)
                    vid = YDStreamExtractor.getVideoInfo(link, quality=1)
                    resolved = vid.streamURL()
                except:
                    pass

    download(title, resolved)
    def resolve(self, url):
        if 'youtu' in url:
            import urlresolver
            return urlresolver.resolve(url)
        if 'fullmatches' in url:
            html = client.request(url)
            try:
                urlx = 'http:' + re.findall(
                    '(\/\/config\.playwire\.com\/[^\'\"]+)', html)[0]
            except:
                urlx = re.findall('iframe.+?src=[\"\'](.+?youtu[^\"\']+)',
                                  html)[0]
            return self.resolve(urlx)
        if 'playwire' not in url and 'http' not in url:
            ref = url
            headers = {
                'Content-Type':
                'application/x-www-form-urlencoded; charset=UTF-8',
                'X-Requested-With': 'XMLHttpRequest',
                'Referer': ref,
                'Origin': self.base,
                'Host': 'fullmatchesandshows.com'
            }
            s = requests.Session()

            video_d = re.findall('id=(.+?(\d+))', url)[0]
            video_id = video_d[1]
            url = url.replace('?id=%s' % video_d[0], '')
            html = client.request(url)

            acp_pid = re.findall(
                "id=[\"\']acp_post[\"\'].+?value=[\"\'](\d+)[\"\']", html)[0]
            post_data = {
                'acp_currpage': video_id,
                'acp_pid': acp_pid,
                'acp_shortcode': 'acp_shortcode',
                'action': 'pp_with_ajax'
            }
            result = s.post(self.post_url, data=post_data,
                            headers=headers).content
            url = 'http:' + re.findall('(\/\/config\.playwire\.com\/[^\'\"]+)',
                                       result)[0]

        result = client.request(url)
        result = json.loads(result)
        try:
            f4m = result['content']['media']['f4m']
        except:
            reg = re.compile('"src":"(http://.+?.f4m)"')
            f4m = re.findall(reg, html)[0]

        result = client.request(f4m)
        soup = webutils.bs(result)
        try:
            base = soup.find('baseURL').getText() + '/'
        except:
            base = soup.find('baseurl').getText() + '/'

        linklist = soup.findAll('media')
        choices, links = [], []
        for link in linklist:
            url = base + link['url']
            bitrate = link['bitrate']
            choices.append(bitrate)
            links.append(url)
            if len(links) == 1:
                return links[0]
            if len(links) > 1:
                import xbmcgui
                dialog = xbmcgui.Dialog()
                index = dialog.select('Select bitrate', choices)
            if index > -1:
                return links[index]
Example #42
0
def playvideo(videosource, name, url=None):
    hosts = []
    if re.search('streamin\.to/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Streamin')
    if re.search('videorev\.cc/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Videorev')
    if re.search('vidto\.me/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Vidto')
    if re.search('openload\.(?:co|io)?/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('OpenLoad')
    if re.search('uptostream\.com/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Uptostream')
    if re.search('dailymotion\.com/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Dailymotion')
    if re.search('thevideos\.tv/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Thevideos')
    if re.search('watchvideo5\.us/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Watchvideo5')
    if re.search('youtube.com', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Youtube')
    if len(hosts) == 0:
        progress.close()
        dialog.ok('Oh no','Couldn\'t find any playable video')
        return
    elif len(hosts) > 1:
        if addon.getSetting("dontask") == "true":
            vidhost = hosts[0]            
        else:
            vh = dialog.select('Videohost:', hosts)
            vidhost = hosts[vh]
    else:
        vidhost = hosts[0]
    
    if vidhost == 'Streamin':
        progress.update( 30, "", "Loading Streamin", "" )
        streaminurl = re.compile(r"//(?:www\.)?streamin\.to/(?:embed-)?([0-9a-zA-Z]+)", re.DOTALL | re.IGNORECASE).findall(videosource)
        streaminurl = chkmultivids(streaminurl)
        streaminurl = 'http://streamin.to/embed-%s-670x400.html' % streaminurl
        progress.update( 50, "", "Loading Streamin", "Sending it to urlresolver" )
        video = urlresolver.resolve(streaminurl)
        if video:
            progress.update( 80, "", "Loading Streamin", "Found the video" )
            videourl = video
    elif vidhost == 'Videorev':
        progress.update( 30, "", "Loading Videorev", "" )
        videorevurl = re.compile(r"(https?://(?:www\.)?videorev\.cc/(?:embed-)?(?:[0-9a-zA-Z]+).html)", re.DOTALL | re.IGNORECASE).findall(videosource)
        videorevurl = chkmultivids(videorevurl)
        videorevsrc = getHtml(videorevurl,'', openloadhdr)
        videorevjs = re.compile("<script[^>]+>(eval[^<]+)</sc", re.DOTALL | re.IGNORECASE).findall(videorevsrc)
        progress.update( 80, "", "Getting video file from Videorev", "" )
        videorevujs = unpack(videorevjs[0])
        videourl = re.compile('file:\s?"([^"]+mp4)"', re.DOTALL | re.IGNORECASE).findall(videorevujs)
        videourl = videourl[0]
    elif vidhost == 'Vidto':
        progress.update( 30, "", "Loading Vidto", "" )
        vidtourl = re.compile(r"//(?:www\.)?vidto\.me/(?:embed-)?([0-9a-zA-Z]+)", re.DOTALL | re.IGNORECASE).findall(videosource)
        vidtourl = chkmultivids(vidtourl)
        vidtourl = 'http://vidto.me/embed-%s-670x400.html' % vidtourl
        progress.update( 50, "", "Loading Vidto", "Sending it to urlresolver" )
        video = urlresolver.resolve(vidtourl)
        if video:
            progress.update( 80, "", "Loading Vidto", "Found the video" )
            videourl = video
    elif vidhost == 'OpenLoad':
        progress.update( 30, "", "Loading Openload", "" )
        openloadurl = re.compile(r"//(?:www\.)?o(?:pen)?load\.(?:co|io)?/(?:embed|f)/([0-9a-zA-Z-_]+)", re.DOTALL | re.IGNORECASE).findall(videosource)
        openloadurl = chkmultivids(openloadurl)
        openloadurl1 = 'http://openload.io/embed/%s/' % openloadurl
        progress.update( 50, "", "Loading Openload", "Sending it to urlresolver" )
        try:
            video = urlresolver.resolve(openloadurl1)
            if video:
                progress.update( 80, "", "Loading Openload", "Found the video" )
                videourl = video
        except:
            notify('Oh oh','Couldn\'t find playable OpenLoad link')
            return
    elif vidhost == 'Uptostream':
        progress.update( 30, "", "Loading Uptostream", "" )
        uptostreamurl = re.compile(r"//(?:www\.)?uptostream\.com/iframe/([0-9a-zA-Z]+)", re.DOTALL | re.IGNORECASE).findall(videosource)
        uptostreamurl = chkmultivids(uptostreamurl)
        uptostreamurl = 'http://uptostream.com/iframe/%s/' % uptostreamurl
        progress.update( 50, "", "Loading Uptostream", "Sending it to urlresolver" )
        video = urlresolver.resolve(uptostreamurl)
        if video:
            progress.update( 80, "", "Loading Uptostream", "Found the video" )
            videourl = video
    elif vidhost == 'Dailymotion':
        progress.update( 30, "", "Loading Dailymotion", "" )
        dailymotionurl = re.compile(r'//(?:www\.)?dailymotion\.com/embed/video/([^"]+)', re.DOTALL | re.IGNORECASE).findall(videosource)
        dailymotionurl = chkmultivids(dailymotionurl)
        dailymotionurl = 'http://www.dailymotion.com/embed/video/%s' % dailymotionurl
        progress.update( 50, "", "Loading Dailymotion", "Sending it to urlresolver" )
        video = urlresolver.resolve(dailymotionurl)
        if video:
            progress.update( 80, "", "Loading Dailymotion", "Found the video" )
            videourl = video
    elif vidhost == 'Thevideos':
        progress.update( 30, "", "Loading Thevideos", "" )
        thevideosurl = re.compile(r"//(?:www\.)?thevideos\.tv/(?:embed-)?([0-9a-zA-Z]+)", re.DOTALL | re.IGNORECASE).findall(videosource)
        thevideosurl = chkmultivids(thevideosurl)
        thevideosurl = 'http://thevideos.tv/embed-%s-728x410.html' % thevideosurl
        progress.update( 50, "", "Loading Thevideos", "Sending it to urlresolver" )
        video = urlresolver.resolve(thevideosurl)
        if video:
            progress.update( 80, "", "Loading Thevideos", "Found the video" )
            videourl = video
    elif vidhost == 'Watchvideo5':
        progress.update( 30, "", "Loading Watchvideo5", "" )
        watchvideo5url = re.compile(r"//(?:www\.)?watchvideo5\.us/(?:embed-)?([0-9a-zA-Z]+)", re.DOTALL | re.IGNORECASE).findall(videosource)
        watchvideo5url = chkmultivids(watchvideo5url)
        watchvideo5url = 'http://watchvideo5.us/embed-%s.html' % watchvideo5url
        progress.update( 50, "", "Loading Watchvideo5", "Sending it to urlresolver" )
        video = urlresolver.resolve(watchvideo5url)
        if video:
            progress.update( 80, "", "Loading Watchvideo5", "Found the video" )
            videourl = video
    elif vidhost == 'Youtube':
        progress.update( 40, "", "Loading Youtube", "" )
        youtubeurl = re.compile("youtube\.com/embed/([^']+)", re.DOTALL | re.IGNORECASE).findall(videosource)
        youtubeurl = chkmultivids(youtubeurl)
        progress.update( 80, "", "Loading Youtube", "Getting video file from Youtube" )
        videourl = "plugin://plugin.video.youtube/?action=play_video&amp;videoid=" + youtubeurl

    progress.close()
    playvid(videourl, name)
Example #43
0
def resolve(url):
    return urlresolver.resolve(url)
Example #44
0
def RESOLVE(name, url):
    addLink(name, urlresolver.resolve(url), artwork + 'play.png')
    AUTO_VIEW('')
def resolve(name, url, iconimage, description):
    hosts = []
    stream_url = []
    host = ''
    try:
        OPEN = Open_Url(url)
        match2 = re.compile('<iframe src=(.+?) w', re.DOTALL).findall(OPEN)
        match = re.compile('href=(.*?)>', re.DOTALL).findall(OPEN)
        for link in match:
            if not 'wholecloud' in link:
                if not 'vidtodo' in link:
                    if urlresolver.HostedMediaFile(link).valid_url():
                        label = link.split('//')[1].replace('www.', '')
                        label = label.split('/')[0].split('.')[0].title()
                        label = label.replace('Tvad', 'TheVideo')
                        host = '[B][COLOR white]%s[/COLOR][/B]' % label
                        hosts.append(host)
                        stream_url.append(link)
        for link in match2:
            if not 'wholecloud' in link:
                if not 'vidtodo' in link:
                    if urlresolver.HostedMediaFile(link).valid_url():
                        label = link.split('//')[1].replace('www.', '')
                        label = label.split('/')[0].split('.')[0].title()
                        label = label.replace('Tvad', 'TheVideo')
                        host = '[B][COLOR white]%s[/COLOR][/B]' % label
                        hosts.append(host)
                        stream_url.append(link)
        if len(match2) > 1:
            dialog = xbmcgui.Dialog()
            ret = dialog.select('Please Select Host', hosts)
            if ret == -1:
                return
            elif ret > -1:
                url = stream_url[ret]
        if len(match) > 1:
            dialog = xbmcgui.Dialog()
            ret = dialog.select('Please Select Host', hosts)
            if ret == -1:
                return
            elif ret > -1:
                url = stream_url[ret]
        else:
            url = re.compile(
                'style="text-align:center">.+?</td>.+?href="(.+?)"').findall(
                    OPEN)[0]
    except:
        xbmc.executebuiltin(
            "XBMC.Notification([COLOR cornflowerblue]Sorry[/COLOR],[COLOR cornflowerblue]No Links Available[/COLOR] ,5000)"
        )
    try:
        stream = urlresolver.resolve(url)
        liz = xbmcgui.ListItem(name,
                               iconImage="DefaultVideo.png",
                               thumbnailImage=iconimage)
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(stream)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        pass
def resolve(name, url, iconimage, description):
    hosts = []
    stream_url = []
    host = ''
    try:
        OPEN = Open_Url(url)
        match = re.compile(
            '{"host":"mp4upload","id":"(.+?)","type":"(.+?)","date"',
            re.DOTALL).findall(OPEN)
        match2 = re.compile(
            '{"host":"trollvid","id":"(.+?)","type":"(.+?)","date"',
            re.DOTALL).findall(OPEN)
        for link, lang in match:
            if 'subbed' in lang:
                vidhost = '[COLOR limegreen]' + lang + '[/COLOR]'
            if 'dubbed' in lang:
                vidhost = '[COLOR yellow]' + lang + '[/COLOR]'
            link = 'https://mp4upload.com/embed-' + link + '.html'
            if "http" not in link:
                link = 'https:' + link
            if not 'wholecloud' in link:
                if not 'vidtodo' in link:
                    if urlresolver.HostedMediaFile(link).valid_url():
                        label = link.split('//')[1].replace('www.', '')
                        label = label.split('/')[0].split('.')[0].title()
                        label = label.replace('Tvad', 'TheVideo')
                        host = '[B][COLOR white]%s[/COLOR][/B]' % label + ' ' + vidhost
                        hosts.append(host)
                        stream_url.append(link)
        for link, lang in match2:
            if 'subbed' in lang:
                vidhost = '[COLOR limegreen]' + lang + '[/COLOR]'
            if 'dubbed' in lang:
                vidhost = '[COLOR yellow]' + lang + '[/COLOR]'
            link = 'https://trollvid.net/embed/' + link
            if not 'wholecloud' in link:
                if not 'vidtodo' in link:
                    if urlresolver.HostedMediaFile(link).valid_url():
                        label = link.split('//')[1].replace('www.', '')
                        label = label.split('/')[0].split('.')[0].title()
                        label = label.replace('Tvad', 'TheVideo')
                        host = '[B][COLOR white]%s[/COLOR][/B]' % label + ' ' + vidhost
                        hosts.append(host)
                        stream_url.append(link)

        if len(match) > 1:
            dialog = xbmcgui.Dialog()
            ret = dialog.select('Please Select Host', hosts)
            if ret == -1:
                return
            elif ret > -1:
                url = stream_url[ret]
        else:
            try:
                url1 = re.compile(
                    '{"host":"trollvid","id":"(.+?)","type').findall(OPEN)[0]
                url = 'https://trollvid.net/embed/' + url1
            except:
                url1 = re.compile(
                    '{"host":"mp4upload","id":"(.+?)","type').findall(OPEN)[0]
                url = 'https://mp4upload.com/embed-' + url1 + '.html'

    except:
        xbmc.executebuiltin(
            "XBMC.Notification([COLOR cornflowerblue]Sorry[/COLOR],[COLOR cornflowerblue]No Links Available[/COLOR] ,5000)"
        )
    try:
        stream = urlresolver.resolve(url)
        liz = xbmcgui.ListItem(name,
                               iconImage="DefaultVideo.png",
                               thumbnailImage=iconimage)
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(stream)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        pass
Example #47
0
        year = get_title(link)[1]
        desc = get_title(link)[2]
        thumb = ''
        fanart = ''

    links = get_links(link)
    hosts = get_host_names(links)
    dialog = xbmcgui.Dialog()
    index = dialog.select('Odaberite link:', hosts)

    prob = ['Film je u vise djelova na youtube-u.', 'Posjetite filmovita.com']
    if index > -1 and links != prob:
        try:
            link = links[index]
            import urlresolver
            resolved = urlresolver.resolve(link)

            li = xbmcgui.ListItem('%s' % title)
            li.setInfo(
                'video', {
                    'title': '%s' % title,
                    'year': '%s' % year,
                    'plotoutline': '%s' % desc,
                    'plot': '%s' % desc,
                    'tagline': '%s' % desc
                })
            li.setThumbnailImage(thumb)
            li.setLabel(desc)
            li.setProperty('IsPlayable', 'true')

            xbmc.Player().play(item=resolved, listitem=li)
Example #48
0
def playvideo(videosource, name, download=None, url=None):
    import urlresolver
    hosts = []
    videourl = None
    if re.search('openload\.(?:co|io)?/', videosource,
                 re.DOTALL | re.IGNORECASE):
        hosts.append('OpenLoad')
    if re.search('oload\.(?:co|io|tv)?/', videosource,
                 re.DOTALL | re.IGNORECASE):
        hosts.append('OpenLoad')
    if re.search('streamin\.to/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Streamin')
    if re.search('flashx\.tv/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('FlashX')
    if re.search('mega3x\.net/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Mega3X')
    if re.search('streamcloud\.eu/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('StreamCloud')
    if re.search('jetload\.tv/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Jetload')
    if re.search('videowood\.tv/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Videowood')
    if re.search('streamdefence.com/view\.php', videosource,
                 re.DOTALL | re.IGNORECASE):
        hosts.append('Streamdefence')
    if re.search('dato\.?p**n.\.?', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Datoporn')
    if re.search('zstream\.to/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('ZStream')
    if re.search('rapidvideo\.com/', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Rapidvideo')
    if re.search('vidlox\.tv', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Vidlox')
    if re.search('<source', videosource, re.DOTALL | re.IGNORECASE):
        hosts.append('Direct Source')
    if not 'keeplinks' in url:
        if re.search('keeplinks\.eu/p', videosource,
                     re.DOTALL | re.IGNORECASE):
            hosts.append('Keeplinks <--')
    if re.search('filecrypt.cc/Container', videosource,
                 re.DOTALL | re.IGNORECASE):
        hosts.append('Filecrypt')
    if len(hosts) == 0:
        progress.close()
        notify('Oh oh', 'Couldn\'t find any video')
        return
    elif len(hosts) > 1:
        if addon.getSetting("dontask") == "true":
            vidhost = hosts[0]
        else:
            vh = dialog.select('Videohost:', hosts)
            if vh == -1:
                return
            vidhost = hosts[vh]
    else:
        vidhost = hosts[0]

    if vidhost == 'OpenLoad':
        progress.update(40, "", "Loading Openload", "")
        openloadurl = re.compile(
            r"//(?:www\.)?o(?:pen)?load\.(?:co|io|tv)?/(?:embed|f)/([0-9a-zA-Z-_]+)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        openloadurl = chkmultivids(openloadurl)

        openloadurl1 = 'http://openload.io/embed/%s/' % openloadurl
        progress.update(50, "", "Loading Openload",
                        "Sending it to urlresolver")
        try:
            video = urlresolver.resolve(openloadurl1)
            if video:
                progress.update(80, "", "Loading Openload", "Found the video")
                videourl = video
        except:
            notify('Oh oh', 'Couldn\'t find playable OpenLoad link')
            return

    elif vidhost == 'Streamin':
        progress.update(40, "", "Loading Streamin", "")
        streaminurl = re.compile(
            r"//(?:www\.)?streamin\.to/(?:embed-)?([0-9a-zA-Z]+)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        streaminurl = chkmultivids(streaminurl)
        streaminurl = 'http://streamin.to/embed-%s-670x400.html' % streaminurl
        progress.update(50, "", "Loading Streamin",
                        "Sending it to urlresolver")
        video = urlresolver.resolve(streaminurl)
        if video:
            progress.update(80, "", "Loading Streamin", "Found the video")
            videourl = video

    elif vidhost == 'FlashX':
        progress.update(40, "", "Loading FlashX", "")
        flashxurl = re.compile(
            r"//(?:www\.)?flashx\.tv/(?:embed-)?([0-9a-zA-Z]+)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        media_id = chkmultivids(flashxurl)
        flashxurl = 'http://www.flashx.tv/%s.html' % media_id
        progress.update(50, "", "Loading FlashX", "Sending it to urlresolver")
        video = urlresolver.resolve(flashxurl)
        if video:
            progress.update(80, "", "Loading FlashX", "Found the video")
            videourl = video

    elif vidhost == 'Mega3X':
        progress.update(40, "", "Loading Mega3X", "")
        mega3xurl = re.compile(
            r"(https?://(?:www\.)?mega3x.net/(?:embed-)?(?:[0-9a-zA-Z]+).html)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        mega3xurl = chkmultivids(mega3xurl)
        mega3xsrc = getHtml(mega3xurl, '', openloadhdr)
        mega3xjs = re.compile("<script[^>]+>(eval[^<]+)</sc",
                              re.DOTALL | re.IGNORECASE).findall(mega3xsrc)
        progress.update(80, "", "Getting video file from Mega3X", "")
        mega3xujs = unpack(mega3xjs[0])
        videourl = re.compile('file:\s?"([^"]+m3u8)"',
                              re.DOTALL | re.IGNORECASE).findall(mega3xujs)
        videourl = videourl[0]

    elif vidhost == 'Datoporn':
        progress.update(40, "", "Loading Datoporn", "")
        datourl = re.compile(
            r"//(?:www\.)?dato\.?p**n(?:.com)?/(?:embed-)?([0-9a-zA-Z]+)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        datourl = chkmultivids(datourl)
        datourl = "http://datoporn.com/embed-" + datourl + ".html"
        datosrc = getHtml(datourl, '', openloadhdr)
        if "File was deleted" in datosrc:
            notify('Oh oh', 'File is deleted from Datoporn')
            return
        try:
            datojs = re.compile("<script[^>]+>(eval[^<]+)</sc",
                                re.DOTALL | re.IGNORECASE).findall(datosrc)
            datoujs = unpack(datojs[0])
        except:
            datoujs = datosrc
        progress.update(80, "", "Getting video file from Datoporn", "")
        videourl = re.compile('file:"([^"]+mp4)"',
                              re.DOTALL | re.IGNORECASE).findall(datoujs)
        videourl = videourl[0]

    elif vidhost == 'StreamCloud':
        progress.update(40, "", "Opening Streamcloud", "")
        streamcloudurl = re.compile(
            r"//(?:www\.)?streamcloud\.eu?/([0-9a-zA-Z-_/.]+html)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        streamcloudurl = chkmultivids(streamcloudurl)
        streamcloudurl = "http://streamcloud.eu/" + streamcloudurl
        progress.update(50, "", "Getting Streamcloud page", "")
        schtml = postHtml(streamcloudurl)
        form_values = {}
        match = re.compile('<input.*?name="(.*?)".*?value="(.*?)">',
                           re.DOTALL | re.IGNORECASE).findall(schtml)
        for name, value in match:
            form_values[name] = value.replace("download1", "download2")
        progress.update(60, "", "Grabbing video file", "")
        newscpage = postHtml(streamcloudurl, form_data=form_values)
        videourl = re.compile('file:\s*"(.+?)",',
                              re.DOTALL | re.IGNORECASE).findall(newscpage)[0]

    elif vidhost == 'Jetload':
        progress.update(40, "", "Loading Jetload", "")
        jlurl = re.compile(r'jetload\.tv/([^"]+)',
                           re.DOTALL | re.IGNORECASE).findall(videosource)
        jlurl = chkmultivids(jlurl)
        jlurl = "http://jetload.tv/" + jlurl
        progress.update(50, "", "Loading Jetload", "")
        #progress.update( 50, "", "Loading Jetload", "Sending it to urlresolver" )
        #video = urlresolver.resolve(jlurl)
        #if video:
        #    progress.update( 80, "", "Loading Jetload", "Found the video" )
        #    videourl = video
        jlsrc = getHtml(jlurl, url)
        videourl = re.compile(r'file: "([^"]+)',
                              re.DOTALL | re.IGNORECASE).findall(jlsrc)
        videourl = videourl[0]

    elif vidhost == 'Videowood':
        progress.update(40, "", "Loading Videowood", "")
        vwurl = re.compile(
            r"//(?:www\.)?videowood\.tv/(?:embed|video)/([0-9a-zA-Z]+)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        vwurl = chkmultivids(vwurl)
        vwurl = 'http://www.videowood.tv/embed/' + vwurl
        progress.update(50, "", "Loading Videowood",
                        "Sending it to urlresolver")
        video = urlresolver.resolve(vwurl)
        if video:
            progress.update(80, "", "Loading Videowood", "Found the video")
            videourl = video

    elif vidhost == 'Keeplinks <--':
        progress.update(40, "", "Loading Keeplinks", "")
        klurl = re.compile(r"//(?:www\.)?keeplinks\.eu/p([0-9a-zA-Z/]+)",
                           re.DOTALL | re.IGNORECASE).findall(videosource)
        klurl = chkmultivids(klurl)
        klurl = 'http://www.keeplinks.eu/p' + klurl
        kllink = getVideoLink(klurl, '')
        kllinkid = kllink.split('/')[-1]
        klheader = {
            'User-Agent':
            'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
            'Accept':
            'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
            'Accept-Encoding': 'none',
            'Accept-Language': 'en-US,en;q=0.8',
            'Connection': 'keep-alive',
            'Cookie': 'flag[' + kllinkid + '] = 1;'
        }
        klpage = getHtml(kllink, klurl, klheader)
        playvideo(klpage, name, download, klurl)
        return

    elif vidhost == 'Streamdefence':
        progress.update(40, "", "Loading Streamdefence", "")
        sdurl = re.compile(r'streamdefence\.com/view.php\?ref=([^"]+)"',
                           re.DOTALL | re.IGNORECASE).findall(videosource)
        sdurl = chkmultivids(sdurl)
        sdurl = 'http://www.streamdefence.com/view.php?ref=' + sdurl
        sdsrc = getHtml(sdurl, url)
        progress.update(80, "", "Getting video file from Streamdefence", "")
        sdpage = streamdefence(sdsrc)
        playvideo(sdpage, name, download, sdurl)
        return

    elif vidhost == 'Filecrypt':
        progress.update(40, "", "Loading Filecrypt", "")
        fcurl = re.compile(r'filecrypt\.cc/Container/([^\.]+)\.html',
                           re.DOTALL | re.IGNORECASE).findall(videosource)
        fcurl = chkmultivids(fcurl)
        fcurl = 'http://filecrypt.cc/Container/' + fcurl + ".html"
        fcsrc = getHtml(fcurl, url)
        fcmatch = re.compile(r"onclick=\"openLink.?'([\w\-]*)',",
                             re.DOTALL | re.IGNORECASE).findall(fcsrc)
        progress.update(80, "", "Getting video file from Filecrypt", "")
        fcurls = ""
        for fclink in fcmatch:
            fcpage = "http://filecrypt.cc/Link/" + fclink + ".html"
            fcpagesrc = getHtml(fcpage, fcurl)
            fclink2 = re.search('<iframe .*? noresize src="(.*)"></iframe>',
                                fcpagesrc)
            if fclink2:
                try:
                    fcurl2 = getVideoLink(fclink2.group(1), fcpage)
                    fcurls = fcurls + " " + fcurl2
                except:
                    pass
        playvideo(fcurls, name, download, fcurl)
        return

    elif vidhost == 'Vidlox':
        if sys.version_info < (2, 7, 9):
            progress.close()
            notify('Oh oh', 'Python version to old, update to Krypton')
            return
        progress.update(40, "", "Loading Vidlox", "")
        vlurl = re.compile(r"(?://|\.)vidlox\.tv/(?:embed-|)([0-9a-zA-Z]+)",
                           re.DOTALL | re.IGNORECASE).findall(videosource)
        media_id = chkmultivids(vlurl)
        vlurl = 'http://vidlox.tv/%s' % media_id
        progress.update(50, "", "Loading Vidlox", "Sending it to urlresolver")
        video = urlresolver.resolve(vlurl)
        if video:
            progress.update(80, "", "Loading Vidlox", "Found the video")
            videourl = video

    elif vidhost == 'ZStream':
        progress.update(40, "", "Loading Zstream", "")
        zstreamurl = re.compile(
            r"(?://|\.)zstream\.to/(?:embed-)?([0-9a-zA-Z]+)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        zstreamurl = chkmultivids(zstreamurl)
        zstreamurl = 'http://zstream.to/embed-%s.html' % zstreamurl
        progress.update(50, "", "Loading ZStream", "Sending it to urlresolver")
        video = urlresolver.resolve(zstreamurl)
        if video:
            progress.update(80, "", "Loading ZStream", "Found the video")
            videourl = video

    elif vidhost == 'Rapidvideo':
        if sys.version_info < (2, 7, 9):
            progress.close()
            notify('Oh oh', 'Python version to old, update to Krypton')
            return
        progress.update(40, "", "Loading Rapidvideo", "")
        rpvideourl = re.compile(
            r"(?://|\.)(?:rapidvideo|raptu)\.com/(?:embed/|e/|\?v=)?([0-9A-Za-z]+)",
            re.DOTALL | re.IGNORECASE).findall(videosource)
        rpvideourl = chkmultivids(rpvideourl)
        rpvideourl = 'http://www.raptu.com/embed/%s' % rpvideourl
        progress.update(50, "", "Loading Rapidvideo",
                        "Sending it to urlresolver")
        video = urlresolver.resolve(rpvideourl)
        if video:
            progress.update(80, "", "Loading Rapidvideo", "Found the video")
            videourl = video

    elif vidhost == 'Direct Source':
        progress.update(40, "", "Loading Direct source", "")
        dsurl = re.compile("""<source.*?src=(?:"|')([^"']+)[^>]+>""",
                           re.DOTALL | re.IGNORECASE).findall(videosource)
        dsurl = chkmultivids(dsurl)
        videourl = dsurl
    progress.close()
    if videourl:
        playvid(videourl, name, download)
    else:
        notify('Oh oh', 'Couldn\'t find a link')
        return
Example #49
0
	rew = soup('ul',{'id':"media-tabs",'class':"uk-switcher"})
	ad = '[COLOR springgreen]%s[/COLOR]' % name
	ad += '%s\n' % rew[0]('ul',{'class':"uk-subnav uk-subnav-line"})[0].text.encode('utf-8')
	ad += '[COLOR springgreen]Descrição[/COLOR]: %s\n' % rew[0]('p',{'class':"uk-text-muted uk-h4"})[0].text.encode('utf-8')
	ad += '%s\n' % rew[0]('dl',{'class':"uk-description-list-horizontal uk-margin-top"})[0].text.encode('utf-8').replace(':\n',':').split('Tags')[0]
	ad = ad.replace('Título Original','[COLOR springgreen]Título Original[/COLOR]').replace('Gênero','[COLOR springgreen]Gênero[/COLOR]').replace('Idioma','[COLOR springgreen]Idioma[/COLOR]')
	ad = ad.replace('IMDb','[COLOR springgreen]IMDb[/COLOR]').replace('Tempo','[COLOR springgreen]Tempo[/COLOR]').replace('Ano','[COLOR springgreen]Ano[/COLOR]').replace('Audio','[COLOR springgreen]Audio[/COLOR]').replace('Video','[COLOR springgreen]Video[/COLOR]').replace('Formato','[COLOR springgreen]Formato[/COLOR]')
	dialog.textviewer(addon_name,ad)
	sys.exit()
elif mode==6:
	import urlresolver
	link = abrir_url(url)
	soup  = bs4(link)
	Trailers = soup('div',{'class':"uk-cover uk-margin-top",'style':"height: 400px;"})
	Trailer = Trailers[0].iframe['src']
	playd = urlresolver.resolve(Trailer)
	listItem = xbmcgui.ListItem(name, thumbnailImage=iconimage)
	xbmc.Player().play(item=playd, listitem=listItem)			
	sys.exit()	
elif mode==100:
	if 'magnet:?xt' in url or '.torrent' in url:	#'xt=urn:btih:([^&/]+) plugin://plugin.video.elementum/play?uri=%s
		Players_Torrent = ['Quasar','Pulsar','Yatp','Torrenter','XbmcTorrent','Torrentin','Elementum','Ace Stream(APK)','BitX Torrent Video Player(APK)']
		if mysettings.getSetting('player_torrent') == Players_Torrent[0]:#"Quasar":
			url = 'plugin://plugin.video.quasar/play?uri={0}'.format(urllib.quote_plus(url))
		elif mysettings.getSetting('player_torrent') == Players_Torrent[1]:# "Pulsar":
			url = 'plugin://plugin.video.pulsar/play?uri={0}'.format(urllib.quote_plus(url))
		elif mysettings.getSetting('player_torrent') == Players_Torrent[2]:#"Yatp":
			url = 'plugin://plugin.video.yatp/?action=play&torrent={0}'.format(urllib.quote_plus(url))
		elif mysettings.getSetting('player_torrent') ==  Players_Torrent[3]:##"Torrenter":
			url = 'plugin://plugin.video.torrenter/?action=playSTRM&url={0}'.format(urllib.quote_plus(url))
		elif mysettings.getSetting('player_torrent') ==  Players_Torrent[4]:# "XbmcTorrent":
Example #50
0
        elif ret == 3:
            # LINK
            kb = xbmc.Keyboard('', 'Use Yatse to copy your link easily', False)
            kb.setDefault(last)
            kb.doModal()
            if (kb.isConfirmed()):
                sys.exit()
            else:
                sys.exit()

        else:
            sys.exit()


if Config.getSetting("showvideo") == 'true':
    player = xbmc.Player()
    player.play(urlresolver.resolve('http://allmyvideos.net/nvi6x5pguqeo'))
    Config.setSetting("showvideo", 'false')
    sys.exit()

if Config.getSetting("showinfo") == 'true':
    Notify()
    Config.setSetting("showinfo", 'false')
    sys.exit()
else:
    lastDVD()

#name, thumb = getInfo("tt0401792")

xbmcplugin.endOfDirectory(int(sys.argv[1]))
Example #51
0
def play_videos(name, url, iconimage, showname):
    if '<>' in showname:
        name=showname.split('<>')[0]
        showname=showname.split('<>')[1]
    hosturl = url
    header_dict = {}
    header_dict['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
    header_dict['Host'] = 'vk.com'
    header_dict['Referer'] = str(hosturl)
    header_dict['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.2; rv:24.0) Gecko/20100101 Firefox/24.0'
    if 'plvids' in url:
        linkvk = net.http_GET(url).content.encode("utf-8").rstrip()
        if 'mail.ru' in linkvk:
            url = regex_from_to(linkvk, 'src="', '"')
            url = url.replace('.html','.json?ver=0.2.60').replace('embed/','')
            max=0
            link = requests.get(url).content
            cookielink = requests.get(url)
            setcookie = cookielink.headers['Set-Cookie']
            match=re.compile('"key":"(.+?)","url":"(.+?)"').findall(link)
            for q,url in match:
                quality=int(q.replace('p',''))
                if quality > max:
                    max=quality
                    playlink="%s|Cookie=%s" % (url,urllib.quote(setcookie))	
        elif 'http://vk.com/video_ext.php?oid' in linkvk:
            url = regex_from_to(linkvk, 'src="', '"').replace('https://p.wplay.me/red.php?u=','').replace('&amp;', '&') + '&hd=1'
            net.set_cookies(cookie_jar)
            link = net.http_GET(url, headers=header_dict).content.encode("utf-8").rstrip()
            net.save_cookies(cookie_jar)
            if 'url720":"' in link:
                vidlinks = re.compile('url720":"(.+?)"').findall(link)
            elif 'url480":"' in link:
                vidlinks = re.compile('url480":"(.+?)"').findall(link)
            elif 'url360":"' in link:
                vidlinks = re.compile('url360":"(.+?)"').findall(link)
            elif 'url240":"' in link:
                vidlinks = re.compile('url240":"(.+?)"').findall(link)
            else: 
                vidlinks = "removed"
            for playlink in vidlinks:
                playlink = playlink.replace('\/', '/')
        elif 'http://www.youtube.com' in linkvk:
            vidlink = regex_from_to(linkvk, 'src="http://www.youtube.com/embed/', 'wmode').replace('?', '')
            vidlinks = "found"
            playlink = ('plugin://plugin.video.youtube/?action=play_video&videoid=%s' % vidlink)
    else:			
        if 'gorillavid.in' in url:
            link = requests.get(url).text
            playlink = regex_from_to(link, 'file: "', '"')
        elif 'nowvideo' in url:
            headers = {'Referer': hosturl, 'Host': 'embed.nowvideo.sx'}
            link = requests.get(url, headers=headers).text
            key = regex_from_to(link, 'var fkzd="', '"').replace('.', '%2E').replace('-', '%2D')
            file = regex_from_to(link, 'flashvars.file="', '"')
            linkurl = 'http://www.nowvideo.sx/api/player.api.php?cid=1&cid3=undefined&key=%s&user=undefined&file=%s&numOfErrors=0&pass=undefined&cid2=undefined' % (key, file)
            link = open_url(linkurl)
            playlink = regex_from_to(link, 'url=', '&title')
        elif 'ishared' in url:
            link = open_url(url).strip().replace('\n', '').replace('\t', '')
            try:
                playlink = regex_from_to(link, 'var zzzz = "', '"')
            except:
                findfile = regex_from_to(link, 'playlist:', 'type')
                key = regex_from_to(findfile, 'file: ', ',')
                playlink = regex_from_to(link, 'var ' + key + ' = "', '"')
        elif 'vk.com' in url:
            url = url.replace('https://p.wplay.me/red.php?u=','').replace('&amp;', '&') + '&hd=1'
            net.set_cookies(cookie_jar)
            link = net.http_GET(url, headers=header_dict).content.encode("utf-8").rstrip()
            net.save_cookies(cookie_jar)
            if 'url720":"' in link:
                vidlinks = re.compile('url720":"(.+?)"').findall(link)
            elif 'url480":"' in link:
                vidlinks = re.compile('url480":"(.+?)"').findall(link)
            elif 'url360":"' in link:
                vidlinks = re.compile('url360":"(.+?)"').findall(link)
            elif 'url240":"' in link:
                vidlinks = re.compile('url240":"(.+?)"').findall(link)
            else: 
                vidlinks = "removed"
            for playlink in vidlinks:
                playlink = playlink.replace('\/', '/')
        else:
            validresolver = urlresolver.HostedMediaFile(url)
            if validresolver:
                playlink = urlresolver.resolve(url)
            

    
    playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playlist.clear()
    listitem = xbmcgui.ListItem(showname + ' ' + name, iconImage=iconimage, thumbnailImage=iconimage)
    playlist.add(playlink,listitem)
    xbmcPlayer = xbmc.Player()
	
    handle = str(sys.argv[1])    
    if handle != "-1":
        listitem.setProperty("IsPlayable", "true")
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
    else:
        xbmcPlayer.play(playlist)
Example #52
0
'''
Example #53
0
'''
Example #54
0
def GetMedia(mediaid):

    from universal import playbackengine
    
    if queued == 'true':
    
        wh = watchhistory.WatchHistory(addon_id)    
                    
        url_content = net.http_POST(MEDIA_PAGE_REQ_URL,
                                    {'watch' : '1',
                                     'episode_id' : mediaid }
                                    ).content
                                    
        media_req_data = re.search(r"proxy\.link\=(.+?)\"", url_content)
        if media_req_data:
            media_req_data = media_req_data.group(1)
                    
            media_response_data = net.http_POST(MEDIA_REQ_URL, {'url':media_req_data}).content            

            media_url = ''
            media_size = 0
                    
            media_content = re.search(r"(?s)\"media\":(.+?),\"description\":", media_response_data)
            if media_content:
                media_links = addon.unescape(media_content.group(1))
                media_links = unescape(media_links)			
                for link in re.finditer("\"url\":\"(.+?)\",\"height\":(.+?),\"width\":(.+?),\"type\":\"(.+?)\"", media_links):

                    if (link.group(4).startswith("image")):
                        continue

                    size = int(link.group(2)) + int(link.group(3))
                    if (size <= media_size):
                        continue

                    media_url = link.group(1)
                    media_size = size

                if media_url:
                    
                    player = playbackengine.Play(resolved_url=media_url, addon_id=addon_id, video_type='wweonline', 
                                title=title,season='', episode='', year='', watchedCallback=WatchedCallback)
                    
                    # add watch history item                    
                    if historylink:
                        wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True, parent_title=historytitle)
                        wh.add_directory(historytitle, historylink, img=img, level='1')
                    else:
                        wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True)
                        
                    player.KeepAlive()
                        
                    
        else:
            check_for_hosted_media = re.search(r"(?s)<embed.*?flashvars.+?file=(.+?)[&\"]{1}", url_content)
            if check_for_hosted_media:        
                hosted_media_url = check_for_hosted_media.group(1)
                hosted_media_url = ReformatHostedMediaUrl(hosted_media_url)
                hosted_media = urlresolver.HostedMediaFile(url=hosted_media_url)
                if hosted_media:
                    resolved_media_url = urlresolver.resolve(hosted_media_url)
                    if resolved_media_url:
                        
                        player = playbackengine.Play(resolved_url=resolved_media_url, addon_id=addon_id, video_type='wweonline', 
                                title=title,season='', episode='', year='', watchedCallback=WatchedCallback)
                        
                        # add watch history item                        
                        if historylink:
                            wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True, parent_title=historytitle)
                            wh.add_directory(historytitle, historylink, img=img, level='1')
                        else:
                            wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True)
                            
                        player.KeepAlive()
            else:
                check_for_hosted_media = re.search(r"(?s)<embed.*?src=\"(.+?)\"", url_content)
               
                if check_for_hosted_media:        
                    hosted_media_url = check_for_hosted_media.group(1)
                    hosted_media_url = ReformatHostedMediaUrl(hosted_media_url)
                    hosted_media = urlresolver.HostedMediaFile(url=hosted_media_url)
                    if hosted_media:
                        print hosted_media_url
                        resolved_media_url = urlresolver.resolve(hosted_media_url)
                        if resolved_media_url:
                            
                            player = playbackengine.Play(resolved_url=resolved_media_url, addon_id=addon_id, video_type='wweonline', 
                                title=title,season='', episode='', year='', watchedCallback=WatchedCallback)
                            
                            # add watch history item
                            if historylink:
                                wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True, parent_title=historytitle)
                                wh.add_directory(historytitle, historylink, img=img, level='1')
                            else:
                                wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True)
                            
                            player.KeepAlive()
                else:
                    check_for_hosted_media = re.search(r"(?s)<iframe.*?src=\"(.+?)\"", url_content)
                    if check_for_hosted_media:        
                        hosted_media_url = check_for_hosted_media.group(1)                        
                        #hosted_media_url = ReformatHostedMediaUrl(hosted_media_url)
                        hosted_media = urlresolver.HostedMediaFile(url=hosted_media_url)
                        if hosted_media:
                            resolved_media_url = urlresolver.resolve(hosted_media_url)
                            if resolved_media_url:
                                
                                player = playbackengine.Play(resolved_url=resolved_media_url, addon_id=addon_id, video_type='wweonline', 
                                    title=title,season='', episode='', year='', watchedCallback=WatchedCallback)
                                
                                # add watch history item
                                if historylink:
                                    wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True, parent_title=historytitle)
                                    wh.add_directory(historytitle, historylink, img=img, level='1')
                                else:
                                    wh.add_video_item(title, sys.argv[0]+sys.argv[2], img=img, is_playable=True)
                                
                                player.KeepAlive()
    else:
        playbackengine.PlayInPL(title, img=img)
Example #55
0
def ResolveUrl(url):
    link = False
    try:
        result = common.OPEN_URL(url)
        matches = re.compile(
            '<div id="embed_code".+?<iframe.+?src=["|\'](.*?)["|\'].+?<\/iframe><\/div>',
            re.I + re.M + re.U + re.S).findall(result)
        url = matches[0]
        if "filehoot" in url:
            url = url.replace("/embed-", "/")
            url = "{0}.html".format(url[:url.rfind('-')])
            html = common.OPEN_URL(url)
            id = re.compile("http://filehoot.com/(.+?).html",
                            re.I + re.M + re.U + re.S).findall(url)
            user_data = {
                'op': 'download1',
                'usr_login': '',
                'id': id[0],
                'fname': '',
                'referer': '',
                'method_free': 'Continue+to+watch+your+Video'
            }
            html = common.OPEN_URL(url, user_data=user_data)
            matches = re.compile('{file:["|\'](.+?)["|\']',
                                 re.I + re.M + re.U + re.S).findall(html)
            if len(matches) > 0:
                link = matches[0]
        elif "allmyvideos" in url:
            html = common.OPEN_URL(url)
            #print html
            matches = re.compile('["|\']file["|\'].+?:.+?["|\'](.+?)["|\']',
                                 re.I + re.M + re.U + re.S).findall(html)
            if len(matches) > 0:
                link = matches[0]
        elif "goodvideohost" in url:
            url = url.replace("/embed-", "/")
            html = common.OPEN_URL(url)

            url = re.compile('method="POST" action=\'(.+?)\'',
                             re.I + re.M + re.U + re.S).findall(html)[0]
            op = re.compile('name="op" value="(.+?)"',
                            re.I + re.M + re.U + re.S).findall(html)[0]
            usr_login = re.compile('name="usr_login" value="(.+?)"',
                                   re.I + re.M + re.U + re.S).findall(html)[0]
            id = re.compile('name="id" value="(.+?)"',
                            re.I + re.M + re.U + re.S).findall(html)[0]
            fname = re.compile('name="fname" value="(.+?)"',
                               re.I + re.M + re.U + re.S).findall(html)[0]
            referer = re.compile('name="referer" value="(.+?)"',
                                 re.I + re.M + re.U + re.S).findall(html)[0]
            hash = re.compile('name="hash" value="(.+?)"',
                              re.I + re.M + re.U + re.S).findall(html)[0]
            imhuman = re.compile('name="imhuman" value="(.+?)"',
                                 re.I + re.M + re.U + re.S).findall(html)[0]

            #user_data = {'op':'download1','usr_login':'','id':id[0],'fname':'','referer':'','hash':hash[0],'imhuman':'Proceed+to+video'}
            user_data = {
                'op': urllib.quote_plus(op),
                'usr_login': urllib.quote_plus(usr_login),
                'id': urllib.quote_plus(id),
                'fname': urllib.quote_plus(fname),
                'referer': urllib.quote_plus(referer),
                'hash': urllib.quote_plus(hash),
                'imhuman': urllib.quote_plus(imhuman)
            }
            html = common.OPEN_URL(url, user_data=user_data)

            matches = re.compile('{file:"(.+?)"',
                                 re.I + re.M + re.U + re.S).findall(html)
            if len(matches) > 0:
                link = matches[0]
        else:
            if "movreel" in url:
                url = url.replace("/embed-", "/")
            item = urlresolver.HostedMediaFile(url)
            link = urlresolver.resolve(item.get_url())
    except:
        pass
    return link
Example #56
0
def getUnzipped(theurl, thedir, thename, generalid):
    """Args:
    * theurl: The URL where the zip can be downloaded
    * thedir: The directory where the zipfile should be saved into
    * thename: The complete filename of the zipfile
    
    Function:
        Retrieves the zipfile from the URL location given, using urlresolver.
        The function then unzips the file.

    WORKAROUND INCLUDED:
        xbmc.extract can't handle a comma in the filename ( up to v12: Frodo)
        The script will remove any comma's in the name of the filename
    """
    theoldname = thename
    name = os.path.join(thedir, thename)
    try:
        if not os.path.exists(thedir):
            os.makedirs(thedir)
    except Exception:
        buggalo.onExceptionRaised()
        #buggalo.onExceptionRaised(thedir)
        print 'can\'t create directory (' + thedir + ')'
        return
    #try:
    print theurl[0:25]
    if urlresolver.HostedMediaFile(
            theurl).valid_url() or theurl[0:25] == "http://www.mediafire.com/":

        try:
            if theurl[0:25] == "http://www.mediafire.com/":
                url = theurl
            else:
                url = urlresolver.resolve(theurl)
            print 'translated link: ' + url
            if download_karaoke_file(url, name, name):
                # Code to circumvent a bug in URIUtils::HasExtension
                thenewname = theoldname.replace(",", "")
                if thenewname != theoldname:
                    newname = os.path.join(thedir, thenewname)
                    os.rename(name, newname)
                    name = newname

                # Python unzip is rubbish!!! gave me corrupted unzips every time
                xbmc.executebuiltin('xbmc.extract(' + name + ')', True)

                # Remove the zip file
                os.unlink(name)
                return 1
            else:
                reportFile('brokenlink', generalid, thename, theurl)
                xbmcgui.Dialog().ok(__addonname__, __language__(70120),
                                    __language__(70121), '')
                return 0
        except:
            xbmcgui.Dialog().ok(__addonname__, __language__(70126),
                                __language__(70127), __language__(70121))
            return 0
    else:
        reportFile('brokenlink', generalid, thename, theurl)
        xbmcgui.Dialog().ok(__addonname__, __language__(70122),
                            __language__(70121), '')
        return 0
    return 0
Example #57
0
def otvori_epizodu(url, title, thumb):
    #prvo pogledaj ako ima vise dijelova
    try:
        html = read_url(url)
        soup = bs(html)
        tag = soup.find('div', {'id': 'Playerholder'})
        frames = tag.findAll('iframe')
        if len(frames) > 1:
            progress = xbmcgui.DialogProgress()
            progress.create('Ucitavam',
                            'Ucitavam dijelove epizoda u playlistu...')

            playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            playlist.clear()
            message = "0 od %s" % (len(frames))
            progress.update(0, "", message, "")
            for i in range(len(frames)):

                link = frames[i]['src']
                import urlresolver

                resolved = urlresolver.resolve(link)
                li = xbmcgui.ListItem('%s' % title)
                li.setInfo('video', {'title': '%s' % title})
                li.setThumbnailImage(thumb)
                playlist.add(resolved, li)

                message = str(i + 1) + " od %s" % (len(frames))
                perc = ((i + 1) / (len(frames))) * 100
                progress.update(perc, "", message, "")

        xbmc.Player().play(playlist)
        return

    except:
        pass

    try:
        html = read_url(url)

        soup = bs(html)
        link = soup.findAll('iframe')[1]['src']

    except:

        try:
            html = read_url(url)

            soup = bs(html)
            link = soup.findAll('iframe')[1]['src']

        except:
            try:
                html = read_url(url)

                soup = bs(html)
                try:
                    link = soup.find('div', {
                        'id': 'Playerholder'
                    }).find('embed')['src']
                except:
                    link = soup.find('div', {
                        'id': 'Playerholder'
                    }).find('iframe')['src']

            except:
                html = read_url(url).lower()
                ind = html.index('player.src')
                html = html[ind:ind + 80]

                reg = r'watch\?v=(.+?)"'
                link = re.findall(re.compile(reg), html)[0]

                link = 'http://www.youtube.com/watch?v=' + link

    try:
        import urlresolver
        resolved = urlresolver.resolve(link)
    except:
        import resolver as srr
        resolved = srr.resolve(link)[0]['url']

    li = xbmcgui.ListItem('%s' % title)
    li.setInfo('video', {'title': '%s' % title})
    li.setThumbnailImage(thumb)
    xbmc.Player().play(item=resolved, listitem=li)
Example #58
0
    def sources(self, url, hostDict, hostprDict):
        sources = []

        try:
            if not url:
                return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])
            url = urlparse.urljoin(self.base_link, data.get('url', ''))
            season = data.get('season')
            episode = data.get('episode')

            oRequest = cRequestHandler(url)
            oRequest.removeBreakLines(False)
            oRequest.removeNewLines(False)
            sHtmlContent = oRequest.request()

            # do we have multiple hoster?
            # i.e. http://kinoger.com/stream/1911-bloodrayne-2-deliverance-2007.html
            link_containers = dom_parser.parse_dom(sHtmlContent, "section")
            if len(
                    link_containers
            ) == 0:  #only one, i.e. http://kinoger.com/stream/890-lucy-2014.html
                #only one
                link_containers = dom_parser.parse_dom(
                    sHtmlContent, "div", attrs={"id": "container-video"})
            for container in link_containers:
                #3 different types found till now: hdgo.show, namba.show and direct (mail.ru etc.)
                # i.e. http://kinoger.com/stream/1911-bloodrayne-2-deliverance-2007.html
                quality = "SD"
                if ".show" in container.content:
                    pattern = ',\[\[(.*?)\]\]'
                    links = re.compile(pattern,
                                       re.DOTALL).findall(container.content)
                    if len(links) == 0: continue
                    #split them up to get season and episode
                    season_array = links[0].split("],[")

                    source_link = None
                    if season and episode:
                        if len(season_array) < int(season):
                            continue
                        episode_array = season_array[int(season) -
                                                     1].split(",")
                        if len(episode_array) < int(episode):
                            continue
                        source_link = episode_array[int(episode) - 1]
                    elif len(season_array) == 1:
                        source_link = season_array[0]

                    if source_link:
                        source_link = source_link.strip("'")

                        valid, host = source_utils.is_host_valid(
                            source_link, hostDict)
                        if valid:
                            resolveurl = urlresolver.resolve(source_link)
                            if "quali" in resolveurl:
                                quality = re.findall('quali.*?=(.*?)\|',
                                                     resolveurl)[0]
                            sources.append({
                                'source': host,
                                'quality': quality,
                                'language': 'de',
                                'url': source_link,
                                'direct': False,
                                'debridonly': False,
                                'checkstreams': True
                            })

                        elif "namba" in container.content:
                            sources.append({
                                'source':
                                'kinoger.com',
                                'quality':
                                quality,
                                'language':
                                'de',
                                'url':
                                "http://v1.kinoger.pw/vod/" + source_link,
                                'direct':
                                False,
                                'debridonly':
                                False,
                                'checkquality':
                                True
                            })

                elif "iframe" in container.content:

                    frame = dom_parser.parse_dom(container.content, "iframe")
                    if len(frame) == 0:
                        continue
                    else:
                        valid, host = source_utils.is_host_valid(
                            frame[0].attrs["src"], hostDict)
                        if not valid: continue
                        resolveurl = urlresolver.resolve(frame[0].attrs["src"])
                        if "quali" in resolveurl:
                            quality = re.findall('quali.*?=(.*?)\|',
                                                 resolveurl)[0]
                        sources.append({
                            'source': host,
                            'quality': quality,
                            'language': 'de',
                            'url': frame[0].attrs["src"],
                            'direct': False,
                            'debridonly': False,
                            'checkstreams': True
                        })
                else:
                    continue

            if len(sources) == 0:
                raise Exception()
            return sources
        except:
            source_faultlog.logFault(__name__, source_faultlog.tagScrape, url)
            return sources
Example #59
0
        li = xbmcgui.ListItem(
            '%s' % links[i][1].replace('LZN', 'Epizoda'),
            iconImage='http://bh-info.com/wp-content/uploads/2015/04/lud.jpg')
        xbmcplugin.addDirectoryItem(handle=addon_handle,
                                    url=url,
                                    listitem=li,
                                    isFolder=True)
    xbmcplugin.endOfDirectory(addon_handle)
elif mode[0] == 'otvori_lzn_ep':
    dicti = urlparse.parse_qs(sys.argv[2][1:])
    url = dicti['url'][0]
    named = dicti['ep'][0].replace('LZN', 'Epizoda')
    name = 'Lud, zbunjen, normalan: ' + named

    import urlresolver
    resolved = urlresolver.resolve(get_izet_video(url))

    li = xbmcgui.ListItem('%s' % name)
    li.setInfo('video', {'title': '%s' % name})

    xbmc.Player().play(item=resolved, listitem=li)

#####################################################################################################################################################################
#Live TV
#####################################################################################################################################################################
elif mode[0] == 'live':
    cats = [
        [
            'Hrvatski', 'hrvatski',
            'http://sprdex.com/wp-content/uploads/2012/07/RTL-televizija.jpg'
        ],
Example #60
0
def otvori_epizodu(url, title, thumb):
    #prvo pogledaj ako ima vise dijelova
    try:
        soup = get_soup(url)
        tag = soup.find('div', {'id': 'Playerholder'})
        frames = tag.findAll('iframe')
        if len(frames) > 1:
            sources = []
            for i in range(len(frames)):
                sources += ['%s. dio' % (i + 1)]
            dialog = xbmcgui.Dialog()
            index = dialog.select('Odaberite:', sources)
            li = xbmcgui.ListItem('%s' % title)
            li.setInfo('video', {'title': '%s' % title})
            li.setThumbnailImage(thumb)
            if index > -1:
                link = frames[index]

                link = link['src']
                try:
                    from lib.resolvers import dailymotion
                    resolved = dailymotion.resolve(link)
                    resolved = resolved[0]['url']

                except:
                    import urlresolver
                    resolved = urlresolver.resolve(link)

                xbmc.Player().play(resolved, li)
                return
            else:
                return

    except:
        pass

    try:
        soup = get_soup(url)
        link = soup.findAll('iframe')[1]['src']

    except:

        try:
            html = read_url(url)

            soup = bs(html)
            link = soup.findAll('iframe')[1]['src']

        except:
            try:
                soup = get_soup(url)
                try:
                    link = soup.find('div', {
                        'id': 'Playerholder'
                    }).find('embed')['src']
                except:
                    link = soup.find('div', {
                        'id': 'Playerholder'
                    }).find('iframe')['src']

            except:
                html = read_url(url).lower()
                ind = html.index('player.src')
                html = html[ind:ind + 80]

                reg = r'watch\?v=(.+?)"'
                link = re.findall(re.compile(reg), html)[0]

                link = 'http://www.youtube.com/watch?v=' + link

    if 'moevideo' in link or 'playreplay' in link:

        import YDStreamExtractor
        vid = YDStreamExtractor.getVideoInfo(link, quality=1)
        resolved = vid.streamURL()

    else:
        try:
            from lib.resolvers import dailymotion
            resolved = dailymotion.resolve(link)
            resolved = resolved[0]['url']

        except:
            try:
                import urlresolver
                resolved = urlresolver.resolve(link)
            except:
                try:
                    import YDStreamExtractor
                    vid = YDStreamExtractor.getVideoInfo(link, quality=1)
                    resolved = vid.streamURL()
                except:
                    pass

    li = xbmcgui.ListItem('%s' % title)
    li.setInfo('video', {'title': '%s' % title})
    li.setThumbnailImage(thumb)
    xbmc.Player().play(item=resolved, listitem=li)