Quantcast
Channel: Kodi Community Forum - All Forums
Viewing all articles
Browse latest Browse all 84004

python: how to get youtube video to play in xbmc

$
0
0
hi i am trying to develop this add-on.

but i am getting this error
Code:
17:49:46 T:2910841712 M:1695137792  NOTICE:
                                             s1.replace = "http://o-o---preferred---sn-jvhj5nu-ab5l---v2---lscache2.c.youtube.com/videoplayback?upn=ukdc318LNtI&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexp​ire&fexp=920921%2C909920%2C902517%2C922401%2C920704%2C912806%2C927201%2C925003%2​C913546%2C913556%2C920201%2C900816%2C911112%2C901451&ms=au&expire=1351829721&itag=43&ipbits=8&gcr=us&sver=3&ratebypass=yes&mt=1351806552&ip=68.81.77.196&mv=m&source=youtube&key=yt1&cp=U0hURlhNV19HS0NONF9QR0FIOlJ5XzNYTkhBVW9W&id=bfabea59ab081dac&signature=5321987EA36D6C91145B02AF256015C274033EEA.1686BD967FB693511E3DC806B​725B9F73AF0F86B"
17:49:46 T:2910841712 M:1695137792 WARNING: CreateLoader - Unsupported protocol("http) in "http://o-o---preferred---sn-jvhj5nu-ab5l---v2---lscache2.c.youtube.com/videoplayback?upn=ukdc318LNtI&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexp​ire&fexp=920921%2C909920%2C902517%2C922401%2C920704%2C912806%2C927201%2C925003%2​C913546%2C913556%2C920201%2C900816%2C911112%2C901451&ms=au&expire=1351829721&itag=43&ipbits=8&gcr=us&sver=3&ratebypass=yes&mt=1351806552&ip=68.81.77.196&mv=m&source=youtube&key=yt1&cp=U0hURlhNV19HS0NONF9QR0FIOlJ5XzNYTkhBVW9W&id=bfabea59ab081dac&signature=5321987EA36D6C91145B02AF256015C274033EEA.tbn
17:49:46 T:2910841712 M:1695137792 WARNING: CreateLoader - Unsupported protocol("http) in "http://o-o---preferred---sn-jvhj5nu-ab5l---v2---lscache2.c.youtube.com/movie.tbn
17:49:46 T:3061753744 M:1694502912  NOTICE: DVDPlayer: Opening: "http://o-o---preferred---sn-jvhj5nu-ab5l---v2---lscache2.c.youtube.com/videoplayback?upn=ukdc318LNtI&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexp​ire&fexp=920921%2C909920%2C902517%2C922401%2C920704%2C912806%2C927201%2C925003%2​C913546%2C913556%2C920201%2C900816%2C911112%2C901451&ms=au&expire=1351829721&itag=43&ipbits=8&gcr=us&sver=3&ratebypass=yes&mt=1351806552&ip=68.81.77.196&mv=m&source=youtube&key=yt1&cp=U0hURlhNV19HS0NONF9QR0FIOlJ5XzNYTkhBVW9W&id=bfabea59ab081dac&signature=5321987EA36D6C91145B02AF256015C274033EEA.1686BD967FB693511E3DC806B​725B9F73AF0F86B"
17:49:46 T:3061753744 M:1694502912 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
17:49:46 T:2900351856 M:1694248960  NOTICE: Creating InputStream
17:49:46 T:2900351856 M:1694248960 WARNING: CreateLoader - Unsupported protocol("http) in "http://o-o---preferred---sn-jvhj5nu-ab5l---v2---lscache2.c.youtube.com/videoplayback?upn=ukdc318LNtI&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexp​ire&fexp=920921%2C909920%2C902517%2C922401%2C920704%2C912806%2C927201%2C925003%2​C913546%2C913556%2C920201%2C900816%2C911112%2C901451&ms=au&expire=1351829721&itag=43&ipbits=8&gcr=us&sver=3&ratebypass=yes&mt=1351806552&ip=68.81.77.196&mv=m&source=youtube&key=yt1&cp=U0hURlhNV19HS0NONF9QR0FIOlJ5XzNYTkhBVW9W&id=bfabea59ab081dac&signature=5321987EA36D6C91145B02AF256015C274033EEA.1686BD967FB693511E3DC806B​725B9F73AF0F86B"
17:49:46 T:2900351856 M:1694248960   ERROR: CDVDPlayer::OpenInputStream - error opening ["http://o-o---preferred---sn-jvhj5nu-ab5l---v2---lscache2.c.youtube.com/videoplayback?upn=ukdc318LNtI&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexp​ire&fexp=920921%2C909920%2C902517%2C922401%2C920704%2C912806%2C927201%2C925003%2​C913546%2C913556%2C920201%2C900816%2C911112%2C901451&ms=au&expire=1351829721&itag=43&ipbits=8&gcr=us&sver=3&ratebypass=yes&mt=1351806552&ip=68.81.77.196&mv=m&source=youtube&key=yt1&cp=U0hURlhNV19HS0NONF9QR0FIOlJ5XzNYTkhBVW9W&id=bfabea59ab081dac&signature=5321987EA36D6C91145B02AF256015C274033EEA.1686BD967FB693511E3DC806B​725B9F73AF0F86B"]
17:49:46 T:2900351856 M:1694248960  NOTICE: CDVDPlayer::OnExit()
17:49:46 T:2900351856 M:1694248960  NOTICE: CDVDPlayer::OnExit() deleting input stream
17:49:46 T:3061753744 M:1694248960   ERROR: Playlist Player: skipping unplayable item: 0, path ["http://o-o---preferred---sn-jvhj5nu-ab5l---v2---lscache2.c.youtube.com/videoplayback?upn=ukdc318LNtI&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexp​ire&fexp=920921%2C909920%2C902517%2C922401%2C920704%2C912806%2C927201%2C925003%2​C913546%2C913556%2C920201%2C900816%2C911112%2C901451&ms=au&expire=1351829721&itag=43&ipbits=8&gcr=us&sver=3&ratebypass=yes&mt=1351806552&ip=68.81.77.196&mv=m&source=youtube&key=yt1&cp=U0hURlhNV19HS0NONF9QR0FIOlJ5XzNYTkhBVW9W&id=bfabea59ab081dac&signature=5321987EA36D6C91145B02AF256015C274033EEA.1686BD967FB693511E3DC806B​725B9F73AF0F86B"]
17:49:46 T:3061753744 M:1694248960  NOTICE: CDVDPlayer::CloseFile()
17:49:46 T:3061753744 M:1694248960 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
17:49:46 T:3061753744 M:1694248960  NOTICE: DVDPlayer: waiting for threads to exit
17:49:46 T:3061753744 M:1694248960  NOTICE: DVDPlayer: finished waiting
however the url plays fine on my fedora machine via mplayer on the command-line.
this is the function that i am having problems with:
Code:
def playvid(url):#  cause mode is empty in this one it will go back to first directory
        print "\n playvid(): url = " + url
        html = urllib2.urlopen(url).read()
        for v in re.finditer('youtube.com/v/(.+?)?autoplay=1', html):
          title = v.groups()
          if title:
            s2 = str(tuple(title))
            s2 = s2.replace("('","\"")
            s2 = s2.replace("',)","\"")
            s2 = s2.replace("?","")
            s2 = s2.replace('"','')
            print "\n  s2 = " + s2

        html = urllib2.urlopen('http://www.youtube.com/watch?v=' + s2).read()
        for v2 in re.finditer('url_encoded_fmt_stream_map.+?url=(http.+?)u0026quality', html):
          vid = v2.groups()
          if vid:
            s1 = str(tuple(vid))
            print "\n ----- s1 = " + s1
            s1 = s1.replace("%3A",":")
            s1 = s1.replace("%2F","/")
            s1 = s1.replace("%3F","?")
            s1 = s1.replace("%3D","=")
            s1 = s1.replace("%252C","%2C")
            s1 = s1.replace("%26","&")
            s1 = s1.replace("%253A",":")
            s1 = s1.replace("('","\"")
            s1 = s1.replace("',)","\"")
            s1 = re.sub("\\\\\\\u0026type.+?sig", "&signature", s1)
            s1 = s1.replace("\\\\","")
            print "\n s1.replace = " + s1
        xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(s1)

Viewing all articles
Browse latest Browse all 84004

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>