FAQ  •  Register  •  Login

YouTube

<<

it.x

Serviio newbie

Posts: 3

Joined: Thu Aug 05, 2021 3:28 pm

Post Thu Aug 05, 2021 3:36 pm

Re: YouTube

Hello,

fast and nice way to bring the Serviio YouTube plugin back to life, is to replace the lines <106..132> (YouTube.groovy rel.09.02.2020/14005B) with this code:

  Code:
// body of youtube.groovy rel.09.02.2020 (14005B)
// lines <0..105>

      for (elType in ['&el=embedded', '&el=detailpage', '&el=vevo', '']) {
            // ver.1 blocked by Google  ca. 01.05.2021 def videoInfoUrl = "https://www.youtube.com/get_video_info?&video_id=$videoId$elType&ps=default&eurl=&gl=US&hl=en"
            // ver.2 blocked by Google  19.06.2021 def videoInfoUrl = "https://www.youtube.com/get_video_info?html5=1&video_id=$videoId$elType&ps=default&eurl=&gl=US&hl=en"
            // ver.3 blocked by Google  30.07.2021 def videoInfoUrl = "https://www.youtube.com/get_video_info?video_id=$videoId&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2F$videoId&html5=1&c=TVHTML5&cver=6.20180913$elType&ps=default&eurl=&gl=US&hl=en"
            def videoInfoUrl = "https://youtubei.googleapis.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
           
            def TmpPost = new URL("https://youtubei.googleapis.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8").openConnection();
            def TmpBody ='{"context": {"client": {"hl": "en",  "clientName": "WEB", "clientVersion": "2.20210721.00.00",  "mainAppWebInfo": {"graftUrl":  "/watch?v='+"$videoId"+'"}}},  "videoId":  "'+"$videoId"+'"}'
            TmpPost.setRequestMethod("POST")
            TmpPost.setDoOutput(true)
            TmpPost.setRequestProperty("Content-Type", "application/json")
            TmpPost.getOutputStream().write(TmpBody.getBytes("UTF-8"))
            //org def videoInfoWebPage = new URL(videoInfoUrl).getText()
            def videoInfoWebPage = TmpPost.getInputStream().getText()         
            //org def parameters = [:]
            //org videoInfoWebPage.split('&').each { item -> addParameter(item, parameters, '=') }
            def jsonSlurper2 = new JsonSlurper()
            def parameters = jsonSlurper2.parseText(videoInfoWebPage)
            // org def playerResponse = parameters['player_response']
            def playerResponse = parameters['responseContext']
            if(playerResponse) {
                //org def pr = new JsonSlurper().parseText(URLDecoder.decode(playerResponse, 'UTF-8'))
                //org def streamingData = pr['streamingData']
                def streamingData =  parameters['streamingData']
                if(!streamingData) {
                    continue
                }

// lines <133..322>
// body of youtube.groovy rel.09.02.2020 (14005B)


Fyi:
- cause of a problem: YouTube API v3 "/get_video_info" issue (looks like step blocking by Google in 2021)
- solution: change groovy URL.GetText() method to REST POST request to symulate native YouTube player and then test new JSON response
- JSON response: property "player_response" has been changed to "responseContext"

- fully modified and functional version of plugin attached
- please remember to manage your own API key ( line 53)

Thanks to:
- https://stackoverflow.com/questions/676 ... -not-found
- https://stackoverflow.com/questions/256 ... ttp-client


Regards and good luck to Serviio Team :)
Attachments
Youtube.groovy
(14.98 KiB) Downloaded 186 times
Last edited by it.x on Thu Sep 02, 2021 7:30 pm, edited 1 time in total.
<<

bmn

Serviio newbie

Posts: 4

Joined: Thu Nov 01, 2012 11:18 am

Post Thu Sep 02, 2021 3:25 pm

Re: YouTube

it.x wrote:Hello,

fast and nice way to bring the Serviio YouTube plugin back to life, is to replace the lines <106..132> (YouTube.groovy rel.09.02.2020/14005B) with this code:


Doesnt work (anymore?).

  Code:

[WebResourceParser] Plugin YouTube returned no value for resource item 'null'



EDIT : btw, returns HTTP ERROR 410
<<

it.x

Serviio newbie

Posts: 3

Joined: Thu Aug 05, 2021 3:28 pm

Post Thu Sep 02, 2021 7:30 pm

Re: YouTube

It works fine and stable for many weeks.

I non stop use searches and channels like this:

SEARCHES:
  Code:
 https://www.googleapis.com/youtube/v3/search?q=YOUR_STRING_TO_FIND&order=date


CHANNELS:
  Code:
https://www.googleapis.com/youtube/v3/channels?forUsername=YOUR_STRING_TO_FIND




Maybe you have a problem with the right Google API key: line 53.

Good luck.
Last edited by it.x on Fri Sep 03, 2021 5:20 pm, edited 1 time in total.
<<

bmn

Serviio newbie

Posts: 4

Joined: Thu Nov 01, 2012 11:18 am

Post Fri Sep 03, 2021 2:34 pm

Re: YouTube

it.x wrote:I
Maybe you have a problem with the right Google API key: line 53.


The key is in line 55 and Im using mine. Still got [WebResourceParser] Plugin YouTube returned no value for resource item 'null'
<<

it.x

Serviio newbie

Posts: 3

Joined: Thu Aug 05, 2021 3:28 pm

Post Fri Sep 03, 2021 5:18 pm

Re: YouTube

My job ended when plugin start working again.

There are many possible causes for your problem: maybe you need search this forum or ask Serviio support for help, but you definitely need to be brave and smart against quotas, firewalls, antivir, etc... :)
<<

Alex532

Serviio newbie

Posts: 2

Joined: Sat Jan 08, 2022 8:53 pm

Post Sat Jan 08, 2022 8:55 pm

Re: YouTube

Greetings to the developer and all users, the plugin is working at the moment, if so then you can have detailed instructions on how to install it from 0, I am using this technology for the first time.
<<

atc98092

User avatar

DLNA master

Posts: 4651

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Sun Jan 09, 2022 1:03 am

Re: YouTube

The instructions for using this plugin should be back in the original post. You have to copy the plugin file into the plugins folder where Serviio is installed on your computer. On Windows, that's C:\Program Files\Serviio\plugins
Dan

LG NANO85 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 8 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

Alex532

Serviio newbie

Posts: 2

Joined: Sat Jan 08, 2022 8:53 pm

Post Sun Jan 09, 2022 7:07 am

Re: YouTube

Thank you for the quick answer, yes I did it, but what to do next, how to open a video from YouTube on my TV?)) :?
Previous

Return to Available plugins

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.