Exemple #1
0
def play_video(siteid, cls, epid, partnum):
    siteid = int(siteid)
    api = BaseForum.__subclasses__()[siteid]()

    part_media = plugin.request.args['media'][0]
    media = []

    import urlresolver
    for host, vid in sorted(part_media, key=lambda x: x[0].server):
        r = urlresolver.HostedMediaFile(
            host=host.server, media_id=vid)
        if r:
            media.append(r)

    source = urlresolver.choose_source(media)
    plugin.log.debug('>>> Source selected')
    plugin.log.debug(source)

    if source:
        url = source.resolve()

        if not __is_resolved(url):
            msg = str(url.msg)
            raise Exception(msg)

        else:
            plugin.log.debug('play video: {url}'.format(url=url))
            plugin.set_resolved_url(url)        
        
    else:
        msg = [_('cannot_play'), _('choose_source')]
        plugin.log.error(msg[0])
        dialog = xbmcgui.Dialog()
        dialog.ok(api.long_name, *msg)
Exemple #2
0
def getVideoUrl(url, name):
    #data = json.load(urllib2.urlopen(url))['streams']
    #for i, item in enumerate(data):
    if (url.find("dailymotion") > -1):
        dailylink = url + "&dk;"
        match = re.compile('www.dailymotion.pl/video/(.+?)-').findall(
            dailylink)
        if (len(match) == 0):
            match = re.compile('/video/(.+?)&dk;').findall(dailylink)
        link = 'http://www.dailymotion.com/video/' + str(match[0])
        vidlink = getDailyMotionUrl(str(match[0]))
    elif (url.find("google") > -1):
        vidcontent = GetContent(url)
        vidmatch = re.compile(
            '"application/x-shockwave-flash"\},\{"url":"(.+?)",(.+?),(.+?),"type":"video/mpeg4"\}'
        ).findall(vidcontent)
        vidlink = vidmatch[0][0]
    elif (url.find("youtube") > -1):
        vidmatch = re.compile(
            '(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)'
        ).findall(url)
        vidlink = vidmatch[0][len(vidmatch[0]) - 1].replace('v/', '')
        vidlink = 'plugin://plugin.video.youtube?path=/root/video&action=play_video&videoid=' + vidlink
    else:
        sources = []
        label = name
        hosted_media = urlresolver.HostedMediaFile(url=url, title=label)
        sources.append(hosted_media)
        source = urlresolver.choose_source(sources)
        print "urlrsolving" + url
        if source:
            vidlink = source.resolve()
        else:
            vidlink = ""
    return vidlink
def VIDEOLINKSSG(mname,murl):
        main.GA("SG","Watched")
        sources = []
        ok=True
        link=main.OPENURL(murl)
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,5000)")
        link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','')
        match=re.compile('href="([^<]+)" TARGET=".+?" >([^<]+)</a>').findall(link)
        for url, host in sorted(match):
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)                
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,5000)")
                        stream_url = source.resolve()
                else:
                      stream_url = False
                      return
                listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': mname, 'Year': ''} )       
                xbmc.Player().play(stream_url, listitem)
                return ok
def play_video(siteid, cls, epid, partnum):
    siteid = int(siteid)
    api = BaseForum.__subclasses__()[siteid]()

    part_media = plugin.request.args['media'][0]
    media = []

    import urlresolver
    for host, vid in sorted(part_media, key=lambda x: x[0].server):
        r = urlresolver.HostedMediaFile(host=host.server, media_id=vid)
        if r:
            media.append(r)

    source = urlresolver.choose_source(media)
    plugin.log.debug('>>> Source selected')
    plugin.log.debug(source)

    if source:
        url = source.resolve()
        plugin.log.debug('play video: {url}'.format(url=url))

        plugin.set_resolved_url(url)

    else:
        msg = [_('cannot_play'), _('choose_source')]
        plugin.log.error(msg[0])
        dialog = xbmcgui.Dialog()
        dialog.ok(api.long_name, *msg)
class TubeplusResolver(Plugin, UrlResolver):
    implements = [UrlResolver]
    name = "tubeplus.me"

    def __init__(self):
        self.net = Net()

    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        #get list
        try:
            html = self.net.http_GET(web_url).content
        except urllib2.URLError, e:
            common.addon.log_error('tubeplus: got http error %d fetching %s' %
                                   (e.code, web_url))
            return False

        r = '"none" href="(.+?)"'
        sources = []
        regex = re.finditer(r, html, re.DOTALL)

        for s in regex:
            sources.append(urlresolver.HostedMediaFile(url=s.group(1)))

        source = urlresolver.choose_source(sources)

        if source:
            stream_url = source.resolve()
        else:
            stream_url = ''
        return stream_url
def LINKSP4(mname, murl):
    sources = []
    main.GA("Oneclickmovies", "Watched")
    link = main.OPENURL(murl)
    ok = True
    link = link.replace('href="http://oneclickmoviez.com/dws/MEGA', "")
    match = re.compile('<a href="(.+?)" target="_blank">(.+?)</a>.+?</p>').findall(link)
    for url, host in match:
        vlink = getlink(url)
        match2 = re.compile("rar").findall(vlink)
        if len(match2) == 0:
            hosted_media = urlresolver.HostedMediaFile(url=vlink, title=host)
            sources.append(hosted_media)
    if len(sources) == 0:
        xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")

    else:
        source = urlresolver.choose_source(sources)
        if source:
            xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
            stream_url = source.resolve()
        else:
            stream_url = False
            return
        listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
        listitem.setInfo("video", {"Title": mname, "Year": ""})
        xbmc.Player().play(stream_url, listitem)
        return ok
def LINKSP3(mname, url):
    main.GA("Dailyfix", "Watched")
    sources = []
    ok = True
    link = main.OPENURL(url)
    match = re.compile("<a href='(.+?)' class='.+?' title='.+?' rel='.+?'>.+?</a").findall(link)
    for murl in match:
        host = re.compile("http://(.+?).com/.+?").findall(murl)
        for hname in host:
            hname = hname.replace("www.", "")
            hosted_media = urlresolver.HostedMediaFile(url=murl, title=hname)
            sources.append(hosted_media)
    if len(sources) == 0:
        xbmc.executebuiltin("XBMC.Notification(Sorry!,Movie doesn't have playable links,5000)")

    else:
        source = urlresolver.choose_source(sources)
        if source:
            xbmc.executebuiltin("XBMC.Notification(Please Wait!,Actual HD Movie Requires Buffer Time,7000)")
            stream_url = source.resolve()
        else:
            stream_url = False
            return
        listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
        listitem.setInfo("video", {"Title": mname, "Year": ""})

        xbmc.Player().play(stream_url, listitem)
        return ok
def VIDEOLINKST3(mname,murl):
        sources = []
        main.GA("OneclickwatchT","Watched")
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Hosts,5000)")
        link=main.OPENURL(murl)
        ok=True
        match=re.compile('<a href="(.+?)">(.+?)</a><br />').findall(link)
        for url, host in match:
                
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)

        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
                        stream_url = source.resolve()
                else:
                        stream_url = False
                        return
                listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': mname, 'Year': ''} )         
                xbmc.Player().play(stream_url, listitem)
                return ok
Exemple #9
0
def LINKFMA(mname,murl):
        main.GA("FMA","Watched")
        sources = []
        ok=True
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,3000)")
        link=main.OPENURL(murl)
        link=link.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','')
        desc=re.compile('<meta name="description" content="(.+?)"').findall(link)
        match=re.compile('<span class=\'.+?\'>(.+?)</span></p><div class=\'.+?\'><img src=\'(.+?)\' /></div><a class=\'.+?\' href="(.+?)"').findall(link)
        for host, thumb, url in match:
                durl='http://www.freemoviesaddict.com/'+url
                redirect=main.REDIRECT(durl)
                print "fff "+redirect
                hosted_media = urlresolver.HostedMediaFile(url=redirect, title=host)
                sources.append(hosted_media)
                
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving links,3000)")
                        stream_url = source.resolve()
                else:
                      stream_url = False
                      return
                listitem = xbmcgui.ListItem(mname, thumbnailImage= thumb)
                listitem.setInfo('video', {'Title': mname, 'Plot': desc[0]} )       
                xbmc.Player().play(stream_url, listitem)
                return ok
def CHANNELCLink(mname,murl):
        main.GA("ChannelCut","Watched")
        sources = []
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,3000)")
        link=main.OPENURL(murl)
        ok=True
        site = re.findall('channelcut',murl)
        if len(site)>0:
            match=re.compile('<p><a href="(.+?)" rel=".+?">.+?</a></p>').findall(link)
        else:
            match=re.compile('<td><a href="(.+?)" target="').findall(link)
        for url in match:
                match2=re.compile('http://(.+?)/.+?').findall(url)
                for host in match2:
                    host = host.replace('www.','')
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)     
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,5000)")
                        stream_url = source.resolve()
                else:
                      stream_url = False
                      return
                listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': mname, 'Year': ''} )       
                xbmc.Player().play(stream_url, listitem)
                return ok
def request_servidores(url,name):
    titles=[]; ligacao=[]
    link=abrir_url(url)
    recolha=re.compile('----- (.+?) ---- (.+?) ---').findall(link)
    for titulo, endereco in recolha:
        titles.append(titulo)
        ligacao.append(endereco)
    if len(ligacao)==1: index=0
    elif len(ligacao)==0: ok=mensagemok('Gato Fedorento', 'Nenhum stream disponivel.'); return     
    else: index = menuescolha('Escolha a parte', titles)
    if index > -1:
        linkescolha=ligacao[index]
        if linkescolha:
            import urlresolver
            sources=[]
            hosted_media = urlresolver.HostedMediaFile(url=linkescolha)
            sources.append(hosted_media)
            source = urlresolver.choose_source(sources)
            if source:
                linkescolha=source.resolve()
                if linkescolha==False:
                    okcheck = xbmcgui.Dialog().ok
                    okcheck(traducao(40000),traducao(40019))
                    return
                comecarvideo(linkescolha,name)
def LINK(mname,murl):
        main.GA("dubzonline-"+mname,"Watched")
        sources = []
        ok=True
        link=main.OPENURL(murl)
        link=link.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','')
        match = re.compile('''<span class='.+?'><b>.+?</b></span><iframe src="(.+?)"''').findall(link)
        for url in match:
                match2=re.compile('http://(.+?)/.+?').findall(url)
                for host in match2:
                    host = host.replace('www.','')
                    if host =='putlocker.com' or host =='sockshare.com':
                                url=url.replace('embed','file')
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)      
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        stream_url = source.resolve()
                else:
                      stream_url = False
                      return
                listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': mname, 'Year': ''} )       
                xbmc.Player().play(stream_url, listitem)
                return ok
Exemple #13
0
def loadVideos(url,name):
                xbmc.executebuiltin("XBMC.Notification(Please Wait!,Loading selected video)")
                link=GetContent(url)
                link = ''.join(link.splitlines()).replace('\t','').replace('\'','"')
        #try:
                newlink = re.compile('"setMedia", {(.+?):"(.+?)"').findall(link)
                if(len(newlink) > 0):
                        (vtmp1,vlink)=newlink[0]
                else:
                        newlink = re.compile('<iframe [^>]*src=["\']?([^>^"^\']+)["\']?[^>]*>').findall(link)
                        vlink=newlink[0]
                match=re.compile('(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)').findall(vlink)
                if(len(match) > 0):
                        lastmatch = match[0][len(match[0])-1].replace('v/','')
                        playVideo('youtube',lastmatch)
                elif (vlink.find("vimeo") > -1):
                        print "newlink|" + vlink
                        idmatch =re.compile("http://player.vimeo.com/video/([^\?&\"\'>]+)").findall(vlink)
                        if(len(idmatch) > 0):
                             playVideo('vimeo',idmatch[0])
                else:
                        sources = []
                        label=name
                        hosted_media = urlresolver.HostedMediaFile(url=vlink, title=label)
                        sources.append(hosted_media)
                        source = urlresolver.choose_source(sources)
            
                        if source:
                              print "in source"
                              vidlink = source.resolve()
                        else:
                              vidlink =vlink
                        print "vidlink" + vidlink
                        playVideo('khmerportal',urllib2.unquote(vidlink).decode("utf8"))
def getVideoUrl(url,name):
   #data = json.load(urllib2.urlopen(url))['streams']
   #for i, item in enumerate(data):
        if(url.find("dailymotion") > -1):
                dailylink = url+"&dk;"
                match=re.compile('www.dailymotion.pl/video/(.+?)-').findall(dailylink)
                if(len(match) == 0):
                        match=re.compile('/video/(.+?)&dk;').findall(dailylink)
                link = 'http://www.dailymotion.com/video/'+str(match[0])
                vidlink=getDailyMotionUrl(str(match[0]))
        elif(url.find("google") > -1):
            vidcontent=GetContent(url)
            vidmatch=re.compile('"application/x-shockwave-flash"\},\{"url":"(.+?)",(.+?),(.+?),"type":"video/mpeg4"\}').findall(vidcontent)
            vidlink=vidmatch[0][0]
        elif(url.find("youtube") > -1):
            vidmatch=re.compile('(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)').findall(url)
            vidlink=vidmatch[0][len(vidmatch[0])-1].replace('v/','')
            vidlink='plugin://plugin.video.youtube?path=/root/video&action=play_video&videoid='+vidlink
        else:
            sources = []
            label=name
            hosted_media = urlresolver.HostedMediaFile(url=url, title=label)
            sources.append(hosted_media)
            source = urlresolver.choose_source(sources)
            print "urlrsolving" + url
            if source:
                vidlink = source.resolve()
            else:
                vidlink =""
        return vidlink
def LINKSP2(mname, url):
    main.GA("Newmyvideolinks", "Watched")
    sources = []
    ok = True
    link = main.OPENURL(url)
    link = link.replace("http://go.etowns.net", "")
    match = re.compile('<li><a href="h(.+?)">(.+?)</a></li>').findall(link)
    for murl, name in match:
        murl = "h" + murl
        hosted_media = urlresolver.HostedMediaFile(url=murl, title=name)
        sources.append(hosted_media)
    if len(sources) == 0:
        xbmc.executebuiltin("XBMC.Notification(Sorry!,Movie doesn't have playable links,5000)")

    else:
        source = urlresolver.choose_source(reversed(sources))
        if source:
            xbmc.executebuiltin("XBMC.Notification(Please Wait!,Actual HD Movie Requires Buffer Time,7000)")
            stream_url = source.resolve()
        else:
            stream_url = False
            return
        listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
        listitem.setInfo("video", {"Title": mname, "Year": ""})

        xbmc.Player().play(stream_url, listitem)
        return ok
def LINKINT3(name,murl):
        sources = []
        main.GA("Cinevip","Watched")
        link=main.OPENURL(murl)
        ok=True
        match=re.compile('<span class=".+?">(.+?)</span></td>\n<td>(.+?)</td>\n<td>.+?</td>\n<td>.+?href=http://adf.ly/.+?/(.+?)>').findall(link)
        if len(match) == 0:
                match=re.compile('<span class=".+?">(.+?)</span></td>\n<td>(.+?)</td>\n<td>.+?</td>\n<td>.+?href="http://adf.ly/.+?/(.+?)"').findall(link)
        for host, lang, url in match:
                print url
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host+' [COLOR red]'+lang+'[/COLOR]')
                sources.append(hosted_media)
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
                        stream_url = source.resolve()
                        if source.resolve()==False:
                                xbmc.executebuiltin("XBMC.Notification(Sorry!,Link Cannot Be Resolved,5000)")
                                return
                else:
                        stream_url = False
                        return
                listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': name, 'Year': ''} )         
                xbmc.Player().play(stream_url, listitem)
                return ok
Exemple #17
0
def PlayUrlSource(url,name):
 try:
    GA("PlayVideo",name)
    xbmc.executebuiltin("XBMC.Notification(if this mirror is a trailer,try another mirror,5000)")
    match=re.compile('(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)').findall(url)
    if(len(match) > 0):
        lastmatch = match[0][len(match[0])-1].replace('v/','')
        playVideo('youtube',lastmatch)
        url1 = 'plugin://plugin.video.youtube?path=/root/video&action=play_video&videoid=' + lastmatch.replace('?','')
        liz = xbmcgui.ListItem('[B]PLAY VIDEO[/B]', thumbnailImage="")
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.add(url=url1, listitem=liz)
    else:
        sources = []
        #try:
        label=name
        hosted_media = urlresolver.HostedMediaFile(url=url, title=label)
        sources.append(hosted_media)
        #except:
        print 'Error while trying to resolve %s' % url

        source = urlresolver.choose_source(sources)
        print "source info=" + str(source)
        if source:
                stream_url = source.resolve()
                print 'Attempting to play url: %s' % stream_url
                playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
                playlist.clear()
                listitem = xbmcgui.ListItem(label, iconImage="", thumbnailImage="")
                playlist.add(url=stream_url, listitem=listitem)
                xbmc.Player().play(playlist)
 except: pass 
def VIDEOLINKSEXTRA(mname,murl):
        main.GA("Extramina","Watched")
        sources = []
        link=main.OPENURL(murl)
        ok=True
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,5000)")
        match=re.compile('<div class="streamlink"><a target=".+?" href="http://adf.ly/.+?/(.+?)">(.+?)</a></div>').findall(link)
        for url, host in match:
                match3=re.compile('extraminamovies').findall(url)
                if len(match3)>0:
                    link2=main.OPENURL(url)
                    match = re.compile('<iframe src="(.+?)"').findall(link2)
                    for url in match:
                        match2=re.compile('http://(.+?)/.+?').findall(url)
                        for host in match2:
                            host = host.replace('www.','')
                            if host =='putlocker.com':
                                url=url.replace('embed','file')
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)        
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        stream_url = source.resolve()
                else:
                      stream_url = False
                      return
                listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': mname, 'Year': ''} )       
                xbmc.Player().play(stream_url, listitem)
                return ok
def VIDEOLINKST(mname,url):
        main.GA("iWatchonline","Watched")
        Mainurl ='http://www.iwatchonline.org'
        url=Mainurl+url
        sources = []
        ok=True
        match=re.compile('http://www.iwatchonline.org/episode/(.+?)-.+?').findall(url)
        for movieid in match:
                url=url + '?tmpl=component&option=com_jacomment&view=comments%20&contentoption=com_content&contentid='+ movieid
        link=main.OPENURL(url)
        match=re.compile('<a href="(.+?)" target="_BLANK" class="vidLinks">(.+?)</a>').findall(link)
        for url, name in match:
                hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
                sources.append(hosted_media)
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
                        stream_url = source.resolve()
                else:
                        stream_url = False
                        return
                listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': mname, 'Year': ''} )         
                xbmc.Player().play(stream_url, listitem)
                return ok
Exemple #20
0
def VIDEOLINKST3(mname,murl):
        sources=[]
        main.GA("OneclickwatchM","Watched")
        ok=True
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Hosts,5000)")
        link=main.OPENURL(murl)
        link=link.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','')
        match=re.compile('<br /><a href="(.+?)">(.+?)</a><br />').findall(link)
        desc=re.compile('<.+? />Plot:(.+?)<.+? />').findall(link)
        if len(desc)>0:
                descs=desc[0]
        else:
                descs=''
        thumb=re.compile('<img alt="" src="(.+?)"').findall(link)
        if len(thumb)>0:
                thumbs=thumb[0]
        else:
               thumbs=''
        for url,host in match:
                print url
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
        try:
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
                        stream_url = source.resolve()
                else:
                        stream_url = False
                        return
                print stream_url
                infoLabels =main.GETMETAT(mname,'','',thumbs)
                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']) }

                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(mname+' '+'[COLOR green]Oneclickwatch[/COLOR]', sys.argv[0]+sys.argv[2], infolabels='', img=img, fanart='', is_folder=False)
                player.KeepAlive()
                return ok
        except Exception, e:
                if stream_url != False:
                        main.ErrorReport(e)
                return ok
Exemple #21
0
def VIDEOLINKSSG(mname,murl,thumb):
    #main.GA("SG","Watched")
    msg = xbmcgui.DialogProgress()
    msg.create('Please Wait!','')
    msg.update(0,'Collecting hosts')
    sources = []
    ok=True
    infoLabels =main.GETMETAEpiT(mname,thumb,'')
    video_type='episode'
    season=infoLabels['season']
    episode=infoLabels['episode']
    link=main.OPENURL(murl)
    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']) }
    link=link.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','').replace('  ','')
    match=re.compile('href="([^"]+)"><img src=".+?" /><span class="link_name_tt">([^<]+)</span>').findall(link)
    hostsmax = len(match)
    h = 0
    import urlresolver
    for url, host in sorted(match):
            host=host.replace('Visit ','')
            h += 1
            percent = (h * 100)/hostsmax
            msg.update(percent,'Collecting hosts - ' + str(percent) + '%')
            if (msg.iscanceled()): break
            hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
            sources.append(hosted_media)                
    if (len(sources)==0):
            xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
            return
    else:
            source = urlresolver.choose_source(sources)
    msg.close()
    try:
        if not source:
            main.CloseAllDialogs()
            return
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
        stream_url = main.resolve_url(source.get_url())
        if stream_url == False: return

        infoL={'Title': infoLabels['title'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre']}
        # play with bookmark
        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)
        #WatchHistory
        if selfAddon.getSetting("whistory") == "true":
            from resources.universal import watchhistory
            wh = watchhistory.WatchHistory('plugin.video.movie25')
            wh.add_item(mname+' '+'[COLOR green]SeriesGate[/COLOR]', sys.argv[0]+sys.argv[2], infolabels=infolabels, img=img, fanart=fanart, is_folder=False)
        player.KeepAlive()
        return ok
    except Exception, e:
        if stream_url != False:
                main.ErrorReport(e)
        return ok
Exemple #22
0
def loadVideos(url,name):
        #try:
           print 'url in loadVideos: ' + url
           GA("LoadVideo",name)
           #urlLink = url.split("++")
           #print urlLink
           #xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
           xbmc.executebuiltin("XBMC.Notification(Xin Vui lòng chờ!, Đang tải phim,2000)")
           newlink = ''
           if(url.find("redirector.googlevideo.com") > 0 or url.find("ad.dailysach.net") > 0 or url.find("117.103.204.132") > 0):
               playVideo('direct',url)
           else:
               link = GetContentMob(url)
               #print 'link in loadvideo' + url + name + link 
           
               match=re.compile('<script src=\'(.+?)\'></script><div id=\'ooyalaplayer\' style=\'width:640px;height:264px;max-width:100%\'></div>').findall(link)
               if(len(match) == 0):
                   match=re.compile('<iframe width="640" height="270" style="max-width:100%;" src="(.+?)" frameborder="0" allowfullscreen></iframe>').findall(link)
                   if(len(match) == 0):
                       match=re.compile('<iframe width="640" height="389" style="max-width:100%;" src="(.+?)" frameborder="0" allowfullscreen></iframe>').findall(link)              
                       if(len(match) == 0):
                           match=re.compile('<source src="(.+?)" type="video/mp4">').findall(link)
               newlink = match[0]
               print newlink
           #newlink = 'http://ad.dailysach.net/mb/mp4/vkool999epeIp2ivi71kvaWVaKeiimyOqtRivLnhqMOAfmiRf3ZwkHmPZpB7p2iMgnttj3GnlJKzuW3In-Jkm7qJhM6To27Dm5egzL_lmcK_h6m7xKOgyK7KnM-O7GqQh3hqi392dJB6i2ePfqFjj4d4ZQ==/video/ZGZ4ZGp2ZQH4ZN==-480.mp4'
               if(newlink == '' or newlink.find("player.ooyala.com") > 0):
                   d = xbmcgui.Dialog()
                   d.ok('Not Implemented','No playable streams found','Please choose different server!!!')
               elif(newlink.find("zing") > 0):
                   playVideo("direct",newlink)
               else:
                   sources = []
                   label=name
                   hosted_media = ""
                   if(newlink.find("youtube") > 0):
                       lastmatch=""
                       match=re.compile('(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)').findall(newlink)
                       #IF MATCH
                       if(len(match) > 0):
                           lastmatch = match[0][len(match[0])-1].replace('v/','')
                       #IF ID FOUND
                       if(len(lastmatch) > 0):
                           print lastmatch
                           hosted_media = urlresolver.HostedMediaFile(url='http://youtube.com/watch?v='+lastmatch, title='youtube')
                       else:
                           d = xbmcgui.Dialog()
                           d.ok('Not Implemented','No playable streams found','Please choose different server!!!')
                           return
                   else:        
                       hosted_media = urlresolver.HostedMediaFile(url=newlink, title=label)
                   sources.append(hosted_media)
                   source = urlresolver.choose_source(sources)
                   #print "urlrsolving" + newlink
                   if source:
                       vidlink = source.resolve()
                   else:
                       vidlink =""
                   playVideo("direct",vidlink)
Exemple #23
0
def GetLinks(section, url): # Get Links
        print 'GETLINKS FROM URL: '+url
        html = net.http_GET(str(url)).content
        CLEAN(html)
        sources = []
        listitem = GetMediaInfo(html)
        print 'LISTITEM: '+str(listitem)
        content = html
        print'CONTENT: '+str(listitem)
        r = re.search('<strong>Links.*</strong>', html)
        if r:
                content = content[:r.start()]

        match = re.compile('href="(.+?)"').findall(content)
        listitem = GetMediaInfo(content)
        for url in match:
                host = GetDomain(url)

                if 'Unknown' in host:
                                continue

                # ignore .rar files
                r = re.search('\part1\part2\part3\part4\part5\.rar.html\.rar\.file[(?:\.html|\.htm)]*', url, re.IGNORECASE)
                if r:
                        continue

                print '*****************************' + host + ' : ' + url
                title = url.rpartition('/')
                title = title[2].replace('.html', '')
                title = title.replace('.htm', '')
                title = title.replace('file', '[COLOR red][B][I]RAR no streaming[/B][/I][/COLOR]')
                title = title.replace('.rar', '[COLOR red][B][I]RAR no streaming[/B][/I][/COLOR]')
                title = title.replace('www.', '')
                title = title.replace ('-','')
                title = title.replace('_',' ')
                title = title.replace('gaz','')
                title = title.replace('NTb','')
                title = title.replace('part1','')
                title = title.replace('part2','')
                title = title.replace('part3','')
                title = title.replace('part4','')
                title = title.replace('part5','')
                title = title.replace('.',' ')
                title = title.replace('720p','[COLOR gold][B][I]720p[/B][/I][/COLOR]')
                title = title.replace('1080p','[COLOR orange][B][I]1080p[/B][/I][/COLOR]')
                title = title.replace('DDLValley eu','')
                title = title.replace('mkv','[COLOR gold][B][I]MKV[/B][/I][/COLOR] ')
                title = title.replace('avi','[COLOR pink][B][I]AVI[/B][/I][/COLOR] ')
                title = title.replace('mp4','[COLOR purple][B][I]MP4[/B][/I][/COLOR] ')
                name = host+'-'+title
                hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
                sources.append(hosted_media)


        source = urlresolver.choose_source(sources)
        if source: stream_url = source.resolve()
        else: stream_url = ''
        xbmc.Player().play(stream_url)
Exemple #24
0
def Play(url, name):
    sources = []
    link = main.OPENURL(url)
    link = link.replace('\r', '').replace('\n', '').replace('\t', '').replace(
        '&nbsp;', '').replace('\\', '')
    xbmc.executebuiltin("XBMC.Notification(Please Wait!,Opening Link,2000)")
    match = re.compile('<a href="([^"]*)" target="_blank">Open video').findall(
        link)
    for url in match:
        url = url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile(
        'Mobile Friendly</span></a>.+?<a href="([^"]*)" target="_blank">Open video</a>'
    ).findall(link)
    for url in match:
        url = url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('action="([^"]*)" style').findall(link)
    for url in match:
        url = url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('location.href = \'([^"]*)\';').findall(link)
    for url in match:
        url = url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('location.href = "([^"]*)";').findall(link)
    for url in match:
        url = url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    if (len(sources) == 0):
        xbmc.executebuiltin(
            "XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")

    else:
        source = urlresolver.choose_source(sources)
        if source:
            stream_url = source.resolve()
            if source.resolve() == False:
                xbmc.executebuiltin(
                    "XBMC.Notification(Sorry!,Link Cannot Be Resolved,5000)")
                return
        else:
            stream_url = False
            return
        listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png")
        listitem.setInfo('video', {'Title': name, 'Year': ''})
        xbmc.Player().play(str(stream_url), listitem)
        main.addDir('', '', '', '')
def url_solver(urlfinal):
	import urlresolver
	sources=[]
	hosted_media = urlresolver.HostedMediaFile(url=urlfinal)
	sources.append(hosted_media)
	source = urlresolver.choose_source(sources)
	if source: stream_url = source.resolve()
	else: stream_url = '-'
	return stream_url
Exemple #26
0
def BUNNYMOVIE(url,name):
        net.set_cookies(cookiejar)
        req = urllib2.Request(url)
        req.add_header('User-Agent',USER_AGENT)
        response = urllib2.urlopen(req)
        soup = BeautifulSoup(response.read()) 
        for elem in soup(text=re.compile(r'Play Now')):
              link = elem.parent['href']
            
                       
        # new GF.TO garbage.. need to resolve link again
        net.set_cookies(cookiejar)
        req = urllib2.Request(link)
        req.add_header('User-Agent',USER_AGENT)
        response = urllib2.urlopen(req)
        link = response.read()
        response.close()
        match=re.compile('window.location="(.+?)";').findall(link)
        for url in match:
             link = unescape(url)
     

        image = soup.find('img',attrs={'class':re.compile(r"aligncenter.+?")})['src'];

        
        plot = soup.findAll('div',attrs={'class':re.compile(r"post.+?section.+?")});
        for div in plot:
             synopsis = div.findAll('p')
             synopsis = synopsis[2].nextSibling
             synopsis = unescape(synopsis)

        trailer = None
        preview = soup.findAll('div',attrs={'class':'video-container'});
        for div in preview:
             trailer = div.find('iframe')['src']
             sources = []
             hosted_media = urlresolver.HostedMediaFile(url=trailer)
             sources.append(hosted_media)
             source = urlresolver.choose_source(sources)
             trailer = source.resolve()
             
        infoLabels = {}
        infoLabels={ "Title": name }
        infoLabels={ "Plot": synopsis }
        #infoLabels={ "Trailer": trailer } Makes Plot disapear for some reason
        
        meta = None
        #getMeta(name=None,season=None,episode=None,year=None,imdbid=None,tvdbid=None):
        try:
             m = [m.start() for m in re.finditer('\\(', name)]
             showname = name[:m[0]-1]
             year = name[m[0]+1:-1]
             meta = getMeta(name=showname,year=year) 
        except:
             pass
               
        addLink(name,link,image,'movie',infoLabels=infoLabels,trailer=trailer,meta=meta) #adds link of episode
Exemple #27
0
def url_solver(urlfinal):
    import urlresolver
    sources = []
    hosted_media = urlresolver.HostedMediaFile(url=urlfinal)
    sources.append(hosted_media)
    source = urlresolver.choose_source(sources)
    if source: stream_url = source.resolve()
    else: stream_url = '-'
    return stream_url
Exemple #28
0
def loadVideos(url,name):
        #try:
           linkcontent= GetContent(url)
           soup = BeautifulSoup(linkcontent)
           vidcontent=soup.findAll('iframe', {"class" : "embed-responsive-item"})[0]
           newlink=vidcontent["src"]
           xbmc.executebuiltin("XBMC.Notification(Please Wait!,Loading selected video)")
           if (newlink.find("dailymotion") > -1):
                match=re.compile('http://www.dailymotion.com/embed/video/(.+?)\?').findall(newlink)
                if(len(match) == 0):
                        match=re.compile('/video/(.+?)&dk;').findall(newlink+"&dk;")
                if(len(match) == 0):
                        match=re.compile('http://www.dailymotion.com/swf/(.+?)\?').findall(newlink)
                if(len(match) == 0):
                	match=re.compile('www.dailymotion.com/embed/video/(.+?)\?').findall(newlink.replace("$","?"))
                vidlink=getDailyMotionUrl(match[0])
                playVideo('dailymontion',vidlink)
           elif (newlink.find("docs.google.com") > -1 or newlink.find("drive.google.com") > -1):  
                vidcontent = GetContent(newlink)
                html = vidcontent.decode('utf8')
                stream_map = re.compile('fmt_stream_map","(.+?)"').findall(html)[0].replace("\/", "/")
                formatArray = stream_map.split(',')
                for formatContent in formatArray:
                     formatContentInfo = formatContent.split('|')
                     qual = formatContentInfo[0]
                     url = (formatContentInfo[1]).decode('unicode-escape')
                playVideo("direct",url)
           elif (newlink.find("4shared") > -1):
                d = xbmcgui.Dialog()
                d.ok('Not Implemented','Sorry 4Shared links',' not implemented yet')		
           elif (newlink.find("vimeo") > -1):
                idmatch =re.compile("http://player.vimeo.com/video/([^\?&\"\'>]+)").findall(newlink)
                if(len(idmatch) == 0):
                        idmatch =re.compile("//vimeo.com/([^\?&\"\'>]+)").findall(newlink)
                if(len(idmatch) > 0):
                        playVideo('vimeo',idmatch[0])
           elif (newlink.find("youtube") > -1) and (newlink.find("list=") > -1):
                playlistid=re.compile('\?list=(.+?)&').findall(newlink+"&")
                vidlink="plugin://plugin.video.youtube?path=/root/video&action=play_all&playlist="+playlistid[0]
                playVideo('moviekhmer',vidlink)
           elif (newlink.find("vidd.me") > -1 or newlink.find("vid.me") > -1):
				tmpcontent=GetContent(newlink)
				vidlink=re.compile('<meta property="og:video:url" [^>]*content=["\']?([^>^"^\']+)["\']?[^>]*>').findall(tmpcontent)[-1]
				playVideo('moviekhmer',vidlink.replace("&amp;","&"))
           else:
                if(newlink.find("putlocker.com") > -1 or newlink.find("sockshare.com") > -1):
                        redir = newlink.split("/file/")
                        newlink = redir[0] +"/file/" + redir[1].upper()
                sources = []
                label=name
                hosted_media = urlresolver.HostedMediaFile(url=newlink, title=label)
                sources.append(hosted_media)
                source = urlresolver.choose_source(sources)
                print "inresolver=" + newlink
                if source:
						vidlink = source.resolve()
						playVideo('moviekhmer',vidlink)
Exemple #29
0
def GetLinks(section, url): # Get Links
        print 'GETLINKS FROM URL: '+url
        html = net.http_GET(str(url)).content
        CLEAN(html)
        sources = []
        listitem = GetMediaInfo(html)
        print 'LISTITEM: '+str(listitem)
        content = html
        print'CONTENT: '+str(listitem)
        r = re.search('<strong>Links.*</strong>', html)
        if r:
                content = html[r.end():]

        match = re.compile('href="(.+?)"').findall(content)
        listitem = GetMediaInfo(content)
        for url in match:
                host = GetDomain(url)

                if 'Unknown' in host:

                        continue
                print '*****************************' + host
                title = url.rpartition('/')
                host = host.replace('','')
                host = host.replace('33b1ad22','xbmc link')
                host = host.replace('.miniurls.co','')
                host = host.replace('rapidgator.net','rapidgator')
                host = host.replace('extabit.com','extabit')
                host = host.replace('ul.to','uploaded')
                host = host.replace('letitbit.net','letitbit')
                host = host.replace('www.sockshare.com','sockshare')
                host = host.replace('www.share-online.biz','share-online')
                host = host.replace('www.putlocker.com','putlocker')
                host = host.replace('turbobit.net','turbobit')
                host = host.replace('ryushare.com','[COLOR red]ryushare[/COLOR]')
                name = host
                hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
                sources.append(hosted_media)

                
        find = re.search('commentblock', html)
        if find:
                print 'in comments if'
                html = html[find.end():]
                CLEAN(html)###
                print 'MATCH IS: '+str(match)
                print len(match)
                for url in match:
                        host = GetDomain(url)
                        if 'Unknown' in host:
                                continue

        source = urlresolver.choose_source(sources)
        if source: stream_url = source.resolve()
        else: stream_url = ''
        xbmc.Player().play(stream_url)
Exemple #30
0
def BUNNYMOVIE(url,name):
        net.set_cookies(cookiejar)
        req = urllib2.Request(url)
        req.add_header('User-Agent',USER_AGENT)
        response = urllib2.urlopen(req)
        soup = BeautifulSoup(response.read())
        
        for elem in soup(text=re.compile(r'Play Now')):
              link = elem.parent['href']
              
        if link.find('gf.to') > -1: # BS you have to do because of stupid cloudflare url shortening.
             net.set_cookies(cookiejar)
             req = urllib2.Request(link)
             req.add_header('User-Agent',USER_AGENT)
             response = urllib2.urlopen(req)
             subsoup = BeautifulSoup(response.read())
             link = subsoup.find('meta',attrs={'http-equiv':'refresh'})
             link = link['content'][7:]
             print link
     

        image = soup.find('img',attrs={'class':re.compile(r"aligncenter.+?")})['src'];

        
        plot = soup.findAll('div',attrs={'class':re.compile(r"post.+?section.+?")});
        for div in plot:
             synopsis = div.findAll('p')
             synopsis = synopsis[2].nextSibling
             synopsis = unescape(synopsis)

        trailer = None
        preview = soup.findAll('div',attrs={'class':'video-container'});
        for div in preview:
             trailer = div.find('iframe')['src']
             sources = []
             hosted_media = urlresolver.HostedMediaFile(url=trailer)
             sources.append(hosted_media)
             source = urlresolver.choose_source(sources)
             trailer = source.resolve()
             
        infoLabels = {}
        infoLabels={ "Title": name }
        infoLabels={ "Plot": synopsis }
        #infoLabels={ "Trailer": trailer } Makes Plot disapear for some reason
        
        meta = None
        #getMeta(name=None,season=None,episode=None,year=None,imdbid=None,tvdbid=None):
        try:
             m = [m.start() for m in re.finditer('\\(', name)]
             showname = name[:m[0]-1]
             year = name[m[0]+1:-1]
             meta = getMeta(name=showname,year=year) 
        except:
             pass
               
        addLink(name,link,image,'movie',infoLabels=infoLabels,trailer=trailer,meta=meta) #adds link of episode
Exemple #31
0
def PlayTrailer(url): #250
	url = url.decode('base-64')
	print 'Attempting to resolve and play trailer at %s' % url
	sources = []
	hosted_media = urlresolver.HostedMediaFile(url=url)
	sources.append(hosted_media)
	source = urlresolver.choose_source(sources)
	if source: stream_url = source.resolve()
	else: stream_url = ''
	xbmc.Player().play(stream_url)
Exemple #32
0
def PlayTrailer(url):
	url = url.decode('base-64')
	print 'Attempting to resolve and play trailer at %s' % url
	sources = []
	hosted_media = urlresolver.HostedMediaFile(url=url)
	sources.append(hosted_media)
	source = urlresolver.choose_source(sources)
	if source: stream_url = source.resolve()
	else: stream_url = ''
	xbmc.Player().play(stream_url)
Exemple #33
0
def GetLinks(section, url):  # Get Links
    print 'GETLINKS FROM URL: ' + url
    html = net.http_GET(str(url)).content
    CLEAN(html)
    sources = []
    listitem = GetMediaInfo(html)
    print 'LISTITEM: ' + str(listitem)
    content = html
    print 'CONTENT: ' + str(listitem)
    r = re.search('<strong>Links.*</strong>', html)
    if r:
        content = html[r.end():]

    match = re.compile('href="(.+?)"').findall(content)
    listitem = GetMediaInfo(content)
    for url in match:
        host = GetDomain(url)

        if 'Unknown' in host:

            continue
        print '*****************************' + host
        title = url.rpartition('/')
        host = host.replace('', '')
        host = host.replace('33b1ad22', 'xbmc link')
        host = host.replace('.miniurls.co', '')
        host = host.replace('rapidgator.net', 'rapidgator')
        host = host.replace('extabit.com', 'extabit')
        host = host.replace('ul.to', 'uploaded')
        host = host.replace('letitbit.net', 'letitbit')
        host = host.replace('www.sockshare.com', 'sockshare')
        host = host.replace('www.share-online.biz', 'share-online')
        host = host.replace('www.putlocker.com', 'putlocker')
        host = host.replace('turbobit.net', 'turbobit')
        host = host.replace('ryushare.com', '[COLOR red]ryushare[/COLOR]')
        name = host
        hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
        sources.append(hosted_media)

    find = re.search('commentblock', html)
    if find:
        print 'in comments if'
        html = html[find.end():]
        CLEAN(html)  ###
        print 'MATCH IS: ' + str(match)
        print len(match)
        for url in match:
            host = GetDomain(url)
            if 'Unknown' in host:
                continue

    source = urlresolver.choose_source(sources)
    if source: stream_url = source.resolve()
    else: stream_url = ''
    xbmc.Player().play(stream_url)
def play_video_continuous(siteid, cls, epid):
    siteid = int(siteid)
    api = BaseForum.__subclasses__()[siteid]()

    temp = plugin.get_storage(temp_storage)
    data = temp['items']

    part_media = data[0]['media']

    media = []

    import urlresolver
    for host, vid in sorted(part_media, key=lambda x: x[0].server):
        r = urlresolver.HostedMediaFile(host=host.server, media_id=vid)
        if r:
            media.append(r)

    source = urlresolver.choose_source(media)
    plugin.log.debug('>>> Source selected')
    plugin.log.debug(source)

    if source:
        selected_host = source.get_host()
        plugin.log.debug('play from host {host}'.format(host=selected_host))

        items = []

        for part in data:
            medialist = part['media']
            stream_url, thumb = __resolve_part(medialist, selected_host)

            items.append({
                'label':
                'Continuous Play: {part}'.format(part=part['label']),
                'path':
                stream_url,
                'thumbnail':
                thumb,
                'icon':
                thumb,
            })

        xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()
        plugin.add_to_playlist(items)

        # Setting resolved url for first item
        # otherwise playlist seems to skip it
        plugin.set_resolved_url(items[0])

    else:
        msg = [_('cannot_play'), _('choose_source')]
        plugin.log.error(msg[0])
        dialog = xbmcgui.Dialog()
        dialog.ok(api.long_name, *msg)
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        r = '"none" href="(.+?)"'
        sources = []
        regex = re.finditer(r, html, re.DOTALL)
        for s in regex:
            sources.append(urlresolver.HostedMediaFile(url=s.group(1)))

        source = urlresolver.choose_source(sources)
        return source.resolve()
Exemple #36
0
def GetLinks(section, url): # Get Links
        print 'GETLINKS FROM URL: '+url
        html = net.http_GET(str(url)).content
        CLEAN(html)
        sources = []
        listitem = GetMediaInfo(html)
        print 'LISTITEM: '+str(listitem)
        content = html
        print'CONTENT: '+str(listitem)
        #r = re.search('editing here', html)
        #if r:
        #        content = html[r.end():]
        match = re.compile('href="(.+?)"').findall(content)
        listitem = GetMediaInfo(content)
        for url in match:
                host = GetDomain(url)

                if 'Unknown' in host:
                        continue
		if 'ultra-vid.com' in host:
			continue
                print '*****************************' + host
                title = url.rpartition('/')
                host = host.replace('.com','')
                host = host.replace('.net','')
                host = host.replace('.es','')
                host = host.replace('.org','')
                host = host.replace('.ch','')
                host = host.replace('.tv','')
                host = host.replace('.sx','')
                host = host.replace('.me','')
                host = host.replace('.to','')
                host = host.replace('youtube','                                        [COLOR gold]Watch trailer[/COLOR]')
                name = host
                hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
                sources.append(hosted_media)
        find = re.search('commentbolck', html)
        if find:
                print 'in comments if'
                html = html[find.end():]
                CLEAN(html)###

                match = re.compile('<a href="(htt.+?)"', re.DOTALL).findall(str(match1))
                print 'MATCH IS: '+str(match)
                print len(match)
                for url in match:
                        host = GetDomain(url)
                        if 'Unknown' in host:
                                continue

        source = urlresolver.choose_source(sources)
        if source: stream_url = source.resolve()
        else: stream_url = ''
        xbmc.Player().play(stream_url)
Exemple #37
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        r = '"none" href="(.+?)"'
        sources = []
        regex = re.finditer(r, html, re.DOTALL)
        for s in regex:
            sources.append(urlresolver.HostedMediaFile(url=s.group(1)))

        source = urlresolver.choose_source(sources)
        return source.resolve()
def episode(path):
    streams = SeriesCravings().episode_streams(path)
    if streams:
        stream = urlresolver.choose_source([
            urlresolver.HostedMediaFile(url=value, title=key)
            for (key, value) in streams.iteritems()
        ])
        plugin.log.error(stream)
        plugin.set_resolved_url(stream.get_url())
    else:
        xbmcgui.Dialog().notification("No Streams", "No usable streams found",
                                      xbmcgui.NOTIFICATION_ERROR, 5000)
Exemple #39
0
def VIDEOLINKSEXTRA(mname,murl,thumb,desc):
        main.GA("Extramina","Watched")
        sources = []
        link=main.OPENURL(murl)
        ok=True
        infoLabels =main.GETMETAT(mname,'','',thumb)
        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']) }
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,5000)")
        match=re.compile('<div class="streamlink"><a target=".+?" href="(.+?)">(.+?)</a></div>').findall(link)
        for url, host in match:
                match3=re.compile('extraminamovies').findall(url)
                if len(match3)>0:
                    link2=main.OPENURL(url)
                    match = re.compile('<iframe src="(.+?)"').findall(link2)
                    if len(match)==0:
                        match = re.compile('src="(.+?)"').findall(link2)
                    for url in match:
                        match2=re.compile('http://(.+?)/.+?').findall(url)
                        for host in match2:
                            host = host.replace('www.','')
                            if host =='putlocker.com':
                                url=url.replace('embed','file')
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)        
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
        try:
                if source:
                        stream_url = source.resolve()
                else:
                      stream_url = False
                      return
                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(mname+' '+'[COLOR green]Extramina[/COLOR]', sys.argv[0]+sys.argv[2], infolabels=infolabels, img=img, fanart='', is_folder=False)
                player.KeepAlive()
                return ok
        except Exception, e:
                if stream_url != False:
                        main.ErrorReport(e)
                return ok
Exemple #40
0
def LINKFMA(mname,murl,thumb,desc):
        main.GA("FMA","Watched")
        sources = []
        ok=True
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,3000)")
        infoLabels =main.GETMETAT(mname,'','',thumb)
        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']) }
        link=main.OPENURL(murl)
        link=link.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','')
        match=re.compile('<span class=\'.+?\'>(.+?)</span></p><div class=\'.+?\'><img src=\'.+?\' /></div><a class=\'.+?\' href="(.+?)"').findall(link)
        import urlresolver
        for host, url in match:
                durl='http://www.freemoviesaddict.com/'+url
                redirect=main.REDIRECT(durl)
                hosted_media = urlresolver.HostedMediaFile(url=redirect, title=host)
                sources.append(hosted_media)
                
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
                  
        else:
                source = urlresolver.choose_source(sources)
        if source != False:
            try:
                xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
                stream_url = main.resolve_url(source.get_url())
                if(stream_url == False):
                    return
                
                infoL={'Title': infoLabels['title'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre']}
                # play with bookmark
                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)
                #WatchHistory
                if selfAddon.getSetting("whistory") == "true":
                    from resources.universal import watchhistory
                    wh = watchhistory.WatchHistory(addon_id)
                    wh.add_item(mname+' '+'[COLOR green]FMA[/COLOR]', sys.argv[0]+sys.argv[2], infolabels=infolabels, img=img, fanart=fanart, is_folder=False)
                player.KeepAlive()
                return ok
            except Exception, e:
                if stream_url != False:
                        main.ErrorReport(e)
                return ok
def VIDEOLINKST2(mname,murl):
        sources = []
        main.GA("Movie1k","Watched")
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Hosts,5000)")
        link=main.OPENURL(murl)
        ok=True
        match=re.compile('<a href="(.+?)">(.+?)</a><br />').findall(link)
        for url, host in match:
                
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)
                
        match2=re.compile(': (.+?)</strong></p>\n<p><a href=".+?watch.php.?idl=(.+?)"').findall(link)
        for host, url in match2:
                matchx=re.compile('sockshare.com').findall(url)
                if (len(matchx)>0):
                    url=url.replace('embed','file')
                matchy=re.compile('putlocker.com').findall(url)
                if (len(matchy)>0):
                    url=url.replace('embed','file')
                hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                sources.append(hosted_media)
                match4=re.compile('linkembed').findall(url)
                if len(match4)>0:
                    link2=main.OPENURL(url)
                    match3=re.compile('<iframe.+?src="(.+?)"').findall(link2)
                    if len(match3)==0:
                        match3=re.compile('<IFRAME SRC="(.+?)"').findall(link2)
                    for url2 in match3:
                        matchx=re.compile('sockshare.com').findall(url2)
                        if (len(matchx)>0):
                            url2=url2.replace('embed','file')
                        matchy=re.compile('putlocker.com').findall(url2)
                        if (len(matchy)>0):
                            url2=url2.replace('embed','file')
                        hosted_media = urlresolver.HostedMediaFile(url=url2, title=host)
                        sources.append(hosted_media)
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,3000)")
                        stream_url = source.resolve()
                else:
                        stream_url = False
                        return
                listitem = xbmcgui.ListItem(mname, iconImage="DefaultVideo.png")
                listitem.setInfo('video', {'Title': mname, 'Year': ''} )         
                xbmc.Player().play(stream_url, listitem)
                return ok
def PLAY(name, url):
    sources = []
    link = main.OPEN_URL(url)
    link = link.replace('\r', '').replace('\n', '').replace('\t', '').replace(
        '&nbsp;', '').replace('\\', '')
    xbmc.executebuiltin("XBMC.Notification(Please Wait!,Opening Link,2000)")
    match = re.compile('http://vidig.biz/([^"]*)').findall(link)
    for url in match:
        url = url = 'http://vidig.biz/' + url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('http://vk.com/([^"]*)').findall(link)
    for url in match:
        url = 'http://vk.com/' + url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('http://www.firedrive.com/([^"]*)\'').findall(link)
    for url in match:
        url = 'http://www.firedrive.com/' + url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('http://dropvideo.com/([^"]*)').findall(link)
    for url in match:
        url = 'http://dropvideo.com/' + url
        print url
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    if (len(sources) == 0):
        xbmc.executebuiltin(
            "XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")

    else:
        source = urlresolver.choose_source(sources)
        if source:
            stream_url = source.resolve()
            if source.resolve() == False:
                xbmc.executebuiltin(
                    "XBMC.Notification(Sorry!,Link Cannot Be Resolved,5000)")
                return
        else:
            stream_url = False
            return
        listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png")
        listitem.setInfo('video', {'Title': name, 'Year': ''})
        xbmc.Player().play(str(stream_url), listitem)
        main.addDir('', '', '', '')
Exemple #43
0
def GetLinks(section, url):  # Get Links
    print 'GETLINKS FROM URL: ' + url
    html = net.http_GET(str(url)).content
    CLEAN(html)
    sources = []
    listitem = GetMediaInfo(html)
    print 'LISTITEM: ' + str(listitem)
    content = html
    print 'CONTENT: ' + str(listitem)
    r = re.search('<strong>Links.*</strong>', html)
    if r:
        content = html[r.end():]

    match = re.compile('href="(.+?)"').findall(content)
    listitem = GetMediaInfo(content)
    for url in match:
        host = GetDomain(url)

        if 'Unknown' in host:

            continue
        print '*****************************' + host
        title = url.rpartition('/')
        host = host.replace('netload.in', '[COLOR gold]Netload[/COLOR]')
        host = host.replace('turbobit.net', '[COLOR gold]Turbobit[/COLOR]')
        host = host.replace(
            'movreel.com',
            'movreel.com - [COLOR red]Download/Streaming limit of 2GB a day !![/COLOR]'
        )
        name = host
        hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
        sources.append(hosted_media)

    find = re.search('commentblock', html)
    if find:
        print 'in comments if'
        html = html[find.end():]
        CLEAN(html)  ###
        print 'MATCH IS: ' + str(match)
        print len(match)
        for url in match:
            host = GetDomain(url)
            if 'Unknown' in host:

                continue
    source = urlresolver.choose_source(sources)
    if source: stream_url = source.resolve()
    else: stream_url = ''
    xbmc.Player().play(stream_url)
Exemple #44
0
def PLAYXXX(name, url):
    sources = []
    link = main.OPENURL(url)
    link = link.replace('\r', '').replace('\n', '').replace('\t', '').replace(
        '&nbsp;', '').replace('\\', '')
    xbmc.executebuiltin("XBMC.Notification(Please Wait!,Opening Link,2000)")
    match = re.compile('<IFRAME SRC="([^"]*)" FRAMEBORDER').findall(link)
    for url in match:
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('src="([^"]*)"></iframe>').findall(link)
    for url in match:
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile('action=\'([^>]*)\'>').findall(link)
    for url in match:
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile(
        'src="([^>]*)" frameborder="0" allowfullscreen=""></iframe></textarea></p>'
    ).findall(link)
    for url in match:
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    match = re.compile(
        'src=\'([^>]*)\' scrolling=\'no\'></iframe></textarea>').findall(link)
    for url in match:
        hosted_media = urlresolver.HostedMediaFile(url=url)
        sources.append(hosted_media)
    if (len(sources) == 0):
        xbmc.executebuiltin(
            "XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")

    else:
        source = urlresolver.choose_source(sources)
        if source:
            stream_url = source.resolve()
            if source.resolve() == False:
                xbmc.executebuiltin(
                    "XBMC.Notification(Sorry!,Link Cannot Be Resolved,5000)")
                return
        else:
            stream_url = False
            return
        listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png")
        listitem.setInfo('video', {'Title': name, 'Year': ''})
        xbmc.Player().play(str(stream_url), listitem)
        main.addDir('', '', '', '')
Exemple #45
0
def LINK (mname,murl,thumb):
        main.GA("MkvMovies","Watched")
        sources = []
        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting hosts,3000)")
        link=main.OPENURL(murl)
        ok=True
        infoLabels =main.GETMETAT(mname,'','',thumb)
        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']) }
        match=re.compile('<a href="([^<]+)" rel="nofollow">Click Here to Download</a>').findall(link)
        for url in match:
                match2=re.compile('http://(.+?)/.+?').findall(url)
                for host in match2:
                    host = host.replace('www.','')
                match3=re.compile('rar').findall(url)
                if len(match3)==0:
                    hosted_media = urlresolver.HostedMediaFile(url=url, title=host)
                    sources.append(hosted_media)
        if (len(sources)==0):
                xbmc.executebuiltin("XBMC.Notification(Sorry!,Show doesn't have playable links,5000)")
      
        else:
                source = urlresolver.choose_source(sources)
        try:
                if source:
                        xbmc.executebuiltin("XBMC.Notification(Please Wait!,Resolving Link,5000)")
                        stream_url = source.resolve()
                else:
                      stream_url = False
                      return
                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(mname+' '+'[COLOR green]MkvMovies[/COLOR]', sys.argv[0]+sys.argv[2], infolabels=infolabels, img=img, fanart=fanart, is_folder=False)
                player.KeepAlive()
                return ok
        except Exception, e:
                if stream_url != False:
                        main.ErrorReport(e)
                return ok
Exemple #46
0
def getVideoUrl(url, name):
    #data = json.load(urllib2.urlopen(url))['streams']
    #for i, item in enumerate(data):
    if (url.find("dailymotion") > -1):
        dailylink = url + "&dk;"
        match = re.compile('www.dailymotion.pl/video/(.+?)-').findall(
            dailylink)
        if (len(match) == 0):
            match = re.compile('/video/(.+?)&dk;').findall(dailylink)
        link = 'http://www.dailymotion.com/video/' + str(match[0])
        vidlink = getDailyMotionUrl(str(match[0]))
    elif (url.find("docs.google.com") > -1
          or url.find("drive.google.com") > -1):
        vidcontent = GetContent(url)
        html = vidcontent.encode("utf-8", "ignore")
        stream_map = re.compile('fmt_stream_map","(.+?)"').findall(html)
        vidlink = ""
        if (len(stream_map) > 0):
            formatArray = stream_map[0].replace("\/", "/").split(',')
            for formatContent in formatArray:
                formatContentInfo = formatContent.split('|')
                qual = formatContentInfo[0]
                vidlink = (formatContentInfo[1]).decode('unicode-escape')
    elif (url.find("google") > -1):
        vidcontent = GetContent(url)
        vidmatch = re.compile(
            '"application/x-shockwave-flash"\},\{"url":"(.+?)",(.+?),(.+?),"type":"video/mpeg4"\}'
        ).findall(vidcontent)
        vidlink = vidmatch[0][0]
    elif (url.find("youtube") > -1):
        vidmatch = re.compile(
            '(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)'
        ).findall(url)
        vidlink = vidmatch[0][len(vidmatch[0]) - 1].replace('v/', '')
        vidlink = 'plugin://plugin.video.youtube?path=/root/video&action=play_video&videoid=' + vidlink
    else:
        sources = []
        label = name
        hosted_media = urlresolver.HostedMediaFile(url=url, title=label)
        sources.append(hosted_media)
        source = urlresolver.choose_source(sources)
        print "urlrsolving" + url
        if source:
            vidlink = source.resolve()
        else:
            vidlink = ""
    return vidlink
Exemple #47
0
    def action_play_video_continuous(self):
        dic = self.args['media']
        byhostdic = pickle.loads(dic)

        source = urlresolver.choose_source(
            [x[1][0] for x in byhostdic.items()])
        if source:
            host = source.get_host()
            logging.debug('play from host: %s' % host)

            playlist = xbmc.PlayList(1)
            playlist.clear()

            # add to playlist
            map(lambda x: self.add_stream_to_playlist(x, playlist),
                byhostdic[host])

            xbmc.Player().play(playlist)
Exemple #48
0
def HandleContent(obj=None, link=False, linkType=False, mode='All'):
    links = []
    if linkType != 'direct_play':
        obj = json.loads(obj)
        links = obj['links']
        if not linkType:
            linkType = obj.get('type',False)
    source = None
    addon.log(msg= link)
    if linkType:
        if len(links)>1:
            # arr = [link['text'] for link in links]
            # index = dialog.select("Please choose:", arr)
            # if index > -1:
            #     addon.log(msg= str(index) + ' enter')
            #     link = links[index]
            for link in links:
                addon.add_item({'mode': 'HandleContent', 'content': 'false', 'link': link['link'], 'linkType': 'direct_play' }, {'title':  link['text']}, img=IconPath + 'video.png', fanart=FanartPath + 'screens.jpg')
            addon.end_of_directory()
        elif len(links)==1:
            index = 0
            link = links[0]
        # if link and index > -1:
        if link:
            # notify(str(index) + ' - ' + link['link'])
            if linkType != 'direct_play':
                link = link['link']
            HandleUrl(link)
    else:
        mediaSrcs = []
        for link in links:
            mediaSrcs.append(urlresolver.HostedMediaFile(url=link,title=GetDomain(link), include_universal=True))
        source = urlresolver.choose_source(mediaSrcs)
        try:            
            if source:
                stream_url = source.resolve()
                # stream_url = commonresolvers.get(url).result
            if stream_url:
                return addon.resolve_url(stream_url)
            
        except:
            e = sys.exc_info()[0]
            if source:
                notify(msg='[COLOR red]Sorry, Can\'t play from this source![/COLOR]')
Exemple #49
0
def ResolveUrl(url, name):
    sources = []
    try:
        label = name
        hosted_media = urlresolver.HostedMediaFile(url=url, title=label)

        sources.append(hosted_media)
    except:
        print 'Error while trying to resolve %s' % url

    source = urlresolver.choose_source(sources)
    print "urlresolving" + url
    if source:
        vidlink = source.resolve()
    else:
        vidlink = ""

    xbmcPlayer = xbmc.Player()
    xbmcPlayer.play(vidlink)
Exemple #50
0
def retrieveVideoInfo(videoUrl):
    
    video_info = Video()
    video_info.set_video_host(getVideoHost())
    video_info.set_id(videoUrl)
    
    sources = []
    hosted_media = urlresolver.HostedMediaFile(url=videoUrl)
    sources.append(hosted_media)
    source = urlresolver.choose_source(sources)
    stream_url = ''
    if source: 
        stream_url = source.resolve()

    video_info.set_stopped(False)
    video_info.set_thumb_image('')
    video_info.set_name(' ')
    video_info.add_stream_link(STREAM_QUAL_SD, stream_url)
    return video_info
Exemple #51
0
def play_stream(name, url, thumb):
    sources = []
    label = name
    format_text = [' ([COLOR orange]',
                   '[/COLOR])',
                   '1080',
                   '720',
                   '480',
                   '360']

    hosted_media = urlresolver.HostedMediaFile(url=url,title=name)
    sources.append(hosted_media)
    source = urlresolver.choose_source(sources)
    for item in format_text:
        name = name.replace(item, '')
    if source:
        vidlink = source.resolve()
        ct.play(name, vidlink, thumb)
    else:
        ct.play(name, url, thumb)
Exemple #52
0
    def action_play_video(self):
        media = self.args['media']
        dl = pickle.loads(media)

        source = urlresolver.choose_source(dl)
        if source:
            stream_url = source.resolve()
        else:
            stream_url = False

        logging.debug('play episode: %s' % stream_url)
        #Play the stream
        if stream_url:
            addon.resolve_url(stream_url)
        else:
            addon.show_error_dialog([
                "[B][COLOR red]Unable to play video[/COLOR][/B]",
                "Please choose another source"
            ])
            return
Exemple #53
0
def GetLinks(section, url):  # Get Links
    print 'GETLINKS FROM URL: ' + url
    html = net.http_GET(str(url)).content
    CLEAN(html)
    sources = []
    listitem = GetMediaInfo(html)
    print 'LISTITEM: ' + str(listitem)
    content = html
    print 'CONTENT: ' + str(listitem)
    r = re.search('<strong>1-CLiCK DDL</strong>', html)
    if r:
        content = html[r.end():]

    if r:
        content = content[:r.start()]

    match = re.compile('href="(.+?)"').findall(content)
    listitem = GetMediaInfo(content)
    for url in match:
        host = GetDomain(url)

        # ignore .rar files
        r = re.search('\.rar\id=5]*', url, re.IGNORECASE)
        if r:
            continue
        print '*****************************' + host + ' : ' + url
        title = url.rpartition('/')
        title = title[2].replace('.html', '')
        title = title.replace('.htm', '')
        title = title.replace('-', ' ')
        title = title.replace('_', ' ')
        name = host + '-' + title
        hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
        sources.append(hosted_media)

    source = urlresolver.choose_source(sources)
    if source: stream_url = source.resolve()
    else: stream_url = ''
    xbmc.Player().play(stream_url)

    xbmcplugin.endOfDirectory(int(sys.argv[1]))
Exemple #54
0
def retrieveVideoInfo(videoUrl):

    video_info = VideoInfo()
    video_info.set_video_hosting_info(getVideoHostingInfo())
    video_info.set_video_id(videoUrl)
    try:
        sources = []
        hosted_media = urlresolver.HostedMediaFile(url=videoUrl)
        sources.append(hosted_media)
        source = urlresolver.choose_source(sources)
        stream_url = ''
        if source:
            stream_url = source.resolve()

        video_info.set_video_stopped(False)
        video_info.set_video_image('')
        video_info.set_video_name(' ')
        video_info.add_video_link(VIDEO_QUAL_SD, stream_url)
    except:
        video_info.set_video_stopped(True)
    return video_info
Exemple #55
0
def PlayUrlSource(url, name):
    try:
        GA("PlayVideo", name)
        xbmc.executebuiltin(
            "XBMC.Notification(if this mirror is a trailer,try another mirror,5000)"
        )
        match = re.compile(
            '(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)'
        ).findall(url)
        if (len(match) > 0):
            lastmatch = match[0][len(match[0]) - 1].replace('v/', '')
            playVideo('youtube', lastmatch)
            url1 = 'plugin://plugin.video.youtube?path=/root/video&action=play_video&videoid=' + lastmatch.replace(
                '?', '')
            liz = xbmcgui.ListItem('[B]PLAY VIDEO[/B]', thumbnailImage="")
            playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
            playlist.add(url=url1, listitem=liz)
        else:
            sources = []
            #try:
            label = name
            hosted_media = urlresolver.HostedMediaFile(url=url, title=label)
            sources.append(hosted_media)
            #except:
            print 'Error while trying to resolve %s' % url

            source = urlresolver.choose_source(sources)
            print "source info=" + str(source)
            if source:
                stream_url = source.resolve()
                print 'Attempting to play url: %s' % stream_url
                playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
                playlist.clear()
                listitem = xbmcgui.ListItem(label,
                                            iconImage="",
                                            thumbnailImage="")
                playlist.add(url=stream_url, listitem=listitem)
                xbmc.Player().play(playlist)
    except:
        pass
Exemple #56
0
def GetLinks(section, url): # Get Links
        print 'GETLINKS FROM URL: '+url
        html = net.http_GET(str(url)).content
        sources = []
        listitem = GetMediaInfo(html)
        print 'LISTITEM: '+str(listitem)
        content = html
        print'CONTENT: '+str(listitem)
        r = re.search('<strong>Links.*</strong>', html)
        if r:
                content = content[:r.start()]

        match = re.compile('href="(.+?)"').findall(content)
        listitem = GetMediaInfo(content)
        for url in match:
                host = GetDomain(url)

                if 'Unknown' in host:
                                continue

                print '*****************************' + host + ' : ' + url
                title = url.rpartition('/')
                title = title[2].replace('.html', '')
                title = title.replace('.htm', '')
                title = title.replace('www.', '')
                title = title.replace ('-','')
                title = title.replace('_',' ')
                title = title.replace('.',' ')
                title = title.replace('720p','[COLOR gold][B][I]720p[/B][/I][/COLOR]')
                title = title.replace('1080p','[COLOR orange][B][I]1080p[/B][/I][/COLOR]')
                title = title.replace('mkv','[COLOR gold][B][I]MKV[/B][/I][/COLOR] ')
                name = host+'-'+title
                hosted_media = urlresolver.HostedMediaFile(url=url, title=name)
                sources.append(hosted_media)


        source = urlresolver.choose_source(sources)
        if source: stream_url = source.resolve()
        else: stream_url = ''
        xbmc.Player().play(stream_url)
Exemple #57
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        #get list
        try:
            html = self.net.http_GET(web_url).content
            
            r = '"none" href="(.+?)"'
            sources = []
            regex = re.finditer(r, html, re.DOTALL)

            for s in regex:
                sources.append(urlresolver.HostedMediaFile(url=s.group(1))) 

            source = urlresolver.choose_source(sources)

            return source.resolve()

        except urllib2.URLError, e:
            common.addon.log_error('Tubeplus: got http error %d fetching %s' %
                                  (e.code, web_url))
            common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo)
            return self.unresolvable(code=3, msg=e)
Exemple #58
0
def loadVideos(url, name):
    xbmc.executebuiltin(
        "XBMC.Notification(Please Wait!,Loading selected video)")
    link = GetContent(url)
    link = ''.join(link.splitlines()).replace('\t', '').replace('\'', '"')
    #try:
    newlink = re.compile('"setMedia", {(.+?):"(.+?)"').findall(link)
    if (len(newlink) > 0):
        (vtmp1, vlink) = newlink[0]
    else:
        newlink = re.compile(
            '<iframe [^>]*src=["\']?([^>^"^\']+)["\']?[^>]*>').findall(link)
        vlink = newlink[0]
    match = re.compile(
        '(youtu\.be\/|youtube-nocookie\.com\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v|user)\/))([^\?&"\'>]+)'
    ).findall(vlink)
    if (len(match) > 0):
        lastmatch = match[0][len(match[0]) - 1].replace('v/', '')
        playVideo('youtube', lastmatch)
    elif (vlink.find("vimeo") > -1):
        print "newlink|" + vlink
        idmatch = re.compile(
            "http://player.vimeo.com/video/([^\?&\"\'>]+)").findall(vlink)
        if (len(idmatch) > 0):
            playVideo('vimeo', idmatch[0])
    else:
        sources = []
        label = name
        hosted_media = urlresolver.HostedMediaFile(url=vlink, title=label)
        sources.append(hosted_media)
        source = urlresolver.choose_source(sources)

        if source:
            print "in source"
            vidlink = source.resolve()
        else:
            vidlink = vlink
        print "vidlink" + vidlink
        playVideo('khmerportal', urllib2.unquote(vidlink).decode("utf8"))