my youtube based addons no longer working
#1
seems like youtube made a change to their api; i have a few addons i tried to make that scrape video urls from youtube but they either crash or return a directory list with nothing in it.

i made the following change to an addon i worked on ( http://hyper.homeftp.net/xbmc/plugin.vid...dz-abg.zip ) and it works... for now:
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/embed/(.+?)?rel', 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
#       vid = url.replace("http://www.youtube.com/v/","")
#       print "\n vid1 = " + vid
#       vid = vid.replace("?autoplay=1","")
#       print "\n vid2 = " + vid

        html=urllib2.urlopen('http://www.youtube.com/watch?v=' + s2).read().replace(",","\\\n")
        for line in html.split("\n"):
             if "itag=22" in line:
             #print " line = " + line
                  s2 = line

        s1 = re.search('url=(http.+?)\\\\', s2)
        sig = re.search('sig=(.+?)\\\\', s2)
        yturl = s1.groups() + sig.groups()
        yturl = str(tuple(yturl))
        print "\n ----- yturl = " + yturl
        yturl = yturl.replace("', '","&signature=")
        yturl = yturl.replace("%3A",":")
        yturl = yturl.replace("%2F","/")
        yturl = yturl.replace("%3F","?")
        yturl = yturl.replace("%3D","=")
        yturl = yturl.replace("%252C","%2C")
        yturl = yturl.replace("%26","&")
        yturl = yturl.replace("%253A",":")
        yturl = yturl.replace("('","\"")
        yturl = yturl.replace("')","\"")
#        yturl = re.sub("\\\\\\\u0026type.+?sig", "&signature", yturl)
#        s1 = s1.replace("\\\\","")
        yturl = yturl.replace('"','')
        print "\n yturl.replace = " + yturl
        xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(yturl)
hope this helps other coders out there.
thanks,
Reply
#2
If you haven't done so already, you may want to drop in on the main YouTube add-on thread and see if they may need help. There has been a lot of activity the past few days regarding recent breakages and patches for that add-on. Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
my youtube based addons no longer working0