Kodi Community Forum
[RELEASE] YouTube3 - YouTube Script - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Video Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=154)
+---- Thread: [RELEASE] YouTube3 - YouTube Script (/showthread.php?tid=33585)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21


Newbie question: How to install this script? - zirbes - 2009-11-17

Hi,

I am new to XBMC and i am still struggling with a few things.

Could you please give me quick advice on how to install and use this youtube script? I've searched the web, the script site, this forum and could find not a single clue as to how to do it.

Thanks in advance,
Zirbes


- Djape - 2009-11-17

Hello,

I have a bad experience where when you search for the video and then select it for play,
after video finishes it almost always returns you to a blank page instead of your searched video list from where you started the video.

Can this be fixed please?
Thank you in advance and respect for all the work so far o7


youtube install - asphodel - 2009-11-17

zirbes :

I presume that you know how to copy files to your xbox; so unzip the above file to your xbmc directory (or simply your Q dir on your xbox) into the scripts folder. it should show up in the script options in xbmc..


- jubal1 - 2009-11-21

Google is shutting down public API access on Dec 2nd, will this plugin be affected by this?

http://www.gizmodo.com.au/2009/11/youtube-shuts-down-api-access-leaves-set-top-boxes-high-and-dry/#more-368437


- Djape - 2009-12-07

jubal1 Wrote:Google is shutting down public API access on Dec 2nd, will this plugin be affected by this?

http://www.gizmodo.com.au/2009/11/youtube-shuts-down-api-access-leaves-set-top-boxes-high-and-dry/#more-368437

Hm, if they start asking for some kind of login to use Youtube API then the script wont work.

If they just state that it is illegal to use it, well...

Anyway, I think this will be a problem for a commercial usage, when you sell the box with Youtube API.

XBMC doesn't sell anything as far as I know...also anyone can make a script for XBMC...

Also, even if they block API, there are many python coders capable to make it work trough their website (TV Shack etc. are good examples).

Just my two cents.

Cheers...


- sprazzi - 2009-12-08

Djape Wrote:Hello,

I have a bad experience where when you search for the video and then select it for play,
after video finishes it almost always returns you to a blank page instead of your searched video list from where you started the video.

Can this be fixed please?
Thank you in advance and respect for all the work so far o7

Same here. Thanks for help.


- sonic - 2009-12-08

Djape Wrote:Hello,

I have a bad experience where when you search for the video and then select it for play,
after video finishes it almost always returns you to a blank page instead of your searched video list from where you started the video.

Can this be fixed please?
Thank you in advance and respect for all the work so far o7


I have the same problem here.


- Ragingaardvark - 2009-12-09

Hi all,
I am using 3.1 of youtube3 on the latest version of XBMC from the site running on Karmic Koala.

I have followed the instructions and fixes in this thread but, as soon as I click on a video to play, I get YouTube 100% on the loading dialogue and the systems hangs - requiring a hard reset.

All other aspects of the plugin - search etc - work correctly.

Does anyone have any ideas?

txs


- RikR - 2009-12-19

any chance of getting a login for YouTube, and access to subscriptions?

Nice script, thanks.


- RikR - 2009-12-20

disreagrd, my grandson added the code to give me a menu item to access my YouTube subscriptions.


- sham021 - 2009-12-20

do VEVO videos on youtube work?


- RikR - 2009-12-20

sham021 Wrote:do VEVO videos on youtube work?

Give a link to one and I will try it for you.


- ossman - 2009-12-24

I've been playing around with this script and trying to get HD working properly (even HQ was non-functional for me). To solve this, I made the stream info parser a bit more advanced. It needs to be polished a bit and made to respect the settings, but hopefully you can make something useful out of it.

New version of get_video_url():

Code:
    def get_video_url(self, id, confirmed=False):
        """Return a proper playback url for some YouTube id."""

        print "Getting video url. Id: " + id
        
        ret = None
        video_id='error'        
        match = self.id_pattern.search(id)
        if match != None and len(match.groups()) >= 1:
            video_id = match.group(1)
            
        print "Video id: " + video_id
        
        #url = id
        url = "http://www.youtube.com/get_video_info?video_id=" + video_id
        data = self.retrieve(url)
        
        if data is not None:
            match2 = self.embed_fail_pattern.search(data)
            if match2 is not None:
                
                data2 = self.retrieve("http://www.youtube.com/watch?v=" + str(video_id))
                more_pattern_match = re.compile('"t": "([^"]+)')
                match2 = more_pattern_match.search(data2)
                
                if match2 is not None:
                    session = match2.group(1)
                    print "Session: " + str(session)
                    ret = self.stream_url % (video_id, session)

            else:
                fields = cgi.parse_qs(data)

                if fields.has_key("fmt_stream_map"):
                    print "Found format map. Trying to select highest quality"

                    streams = {}
                    urls = fields["fmt_stream_map"][0].split(",")
                    for u in urls:
                        (q, s) = u.split("|", 1)
                        streams[q] = s

                    if streams.has_key("22"): # HD
                        ret = streams["22"]
                    elif streams.has_key("35"): # New high quality
                        ret = streams["35"]
                    elif streams.has_key("18"): # Old, hidden high quality
                        ret = streams["18"]
                    elif streams.has_key("6"): # Old high quality
                        ret = streams["6"]
                    else:
                        # Just pick the first entry
                        ret = streams[streams.keys()[0]]
                elif fields.has_key("token"):
                    print "Using token based stream URI"

                    session = urllib.quote(fields["token"][0])
                    ret = self.stream_url % (video_id, session)

        if ret is None:
            print "Ret is none!"
            # Failed to find the video stream url, better complain.
            raise VideoStreamError(id)    
        else:
            print "Return: " + str(ret)
        
        return ret

You need to import cgi and urllib for this new code.

Also, you might want to consider tweaking id_pattern to 'v=([^&]+)' to get rid of any junk following it.

Thanks for a great script. Smile


- sham021 - 2009-12-25

RikR Wrote:Give a link to one and I will try it for you.


http://www.youtube.com/watch?v=5qm8PH4xAss

thanks.


- cromity123 - 2009-12-26

RikR Wrote:disreagrd, my grandson added the code to give me a menu item to access my YouTube subscriptions.

any chance you could make this available to the rest of us please, RikR. This would be really handy for me too!