FAQ  •  Register  •  Login

YouTube

<<

it.x

Serviio newbie

Posts: 7

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/55 acc. to file version)
- 17.06.2022: reformatting comments and testing original Serviio API key (at this time works fine)

*** WARNING ***
- ca. 20.06.2024: plugin is not working at this time. New changes by Google and direct links are still available but not accessible (ffmpeg: HTTP error 403 forbidden). The new working version is here:

viewtopic.php?f=20&t=3276&p=137216#p137216

*** WARNING ***

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


Enjoj :) and You're welcome with requests, questions or suggestions: http://itx.cba.pl?s=Serviio


Regards and good luck to Serviio Team :)
Attachments
Youtube.groovy
(15.31 KiB) Downloaded 5515 times
Last edited by it.x on Sun Mar 09, 2025 1:52 am, edited 14 times 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: 7

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: 7

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: 5432

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: AMD Ryzen 5 5600GT, 32 gig ram, Windows 11 Pro, 22 TB hard drive space | Test server: Intel i5-6400, 16 gig ram, Windows 10 Pro

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?)) :?
<<

SlavaUkraini

Serviio newbie

Posts: 4

Joined: Thu Apr 07, 2022 3:59 pm

Post Thu Apr 07, 2022 4:06 pm

Re: YouTube

Unfortunately the offered plugin has errors, about 9 lines of the previous version were missing, the attribute "streamingFormats" was no longer defined. :roll:

I guess that an own Google API key is still required and has to be set in line 57 of my version.
Attachments
Youtube.groovy
Youtube plugin for Serviio
(16.13 KiB) Downloaded 5602 times
<<

it.x

Serviio newbie

Posts: 7

Joined: Thu Aug 05, 2021 3:28 pm

Post Thu Jun 02, 2022 11:03 pm

Re: YouTube

Hello,

It works fine and stable - I use it often and conveniently with DLNA vs TV Sony Bravia sets or Sony Blu-ray/DVD/network/multimedia/... , several models of Android TV box and few other native DLNA players like Android/iOS apps etc.

I see that you are using the wrong version of groovy file to modify.

Maybe I will help by repeating - two ways:

1. (education:) get the original, last working file, from Serviio Admins post:

https://forum.serviio.org/viewtopic.php?f=20&t=3276&hilit=you+tube#p21613
(Youtube.groovy rel.09.02.2020/14005B)

than make the modifications I am writing about:

https://forum.serviio.org/viewtopic.php?f=20&t=3276&hilit=you+tube&start=580#p133877


that is replace lines <106..132> with new code and manage your own API key at line 53.



2. (fast) get the file already modified by me:

https://forum.serviio.org/viewtopic.php?f=20&t=3276&hilit=you+tube&start=580#p133877
(Youtube.groovy rel.30.07.2021/15673B)

and manage only your own API key at line 55.

good luck
it.x
<<

it.x

Serviio newbie

Posts: 7

Joined: Thu Aug 05, 2021 3:28 pm

Post Wed Jun 26, 2024 11:43 pm

Re: YouTube

*** WARNING ***

- ca. 20.06.2024: plugin is not working at this time. New changes by Google and direct links are still available but not accessible (ffmpeg: HTTP error 403 forbidden). The new working version is here:

viewtopic.php?f=20&t=3276&p=137216#p137216

*** WARNING ***
Last edited by it.x on Sat Feb 08, 2025 12:02 am, edited 1 time in total.
<<

junior

Serviio newbie

Posts: 1

Joined: Sat Aug 24, 2024 9:44 am

Post Sat Aug 24, 2024 9:46 am

Re: YouTube

Any update on this?
<<

it.x

Serviio newbie

Posts: 7

Joined: Thu Aug 05, 2021 3:28 pm

Post Fri Feb 07, 2025 11:59 pm

Re: YouTube

Hello,

next working bypass here: we use YTDLP.ONLINE sevice to solve YouTube signatures.

Changes:
- new lines <116..142>: handling HTTP GET request to ytdlp.online
- new line 5: import java.util.regex.Matcher
- new line 6: import java.util.regex.Pattern
- changed variable name: TmpPost ->TmpHttpPost
- changed variable name: TmpBody ->TmpHttpBody
- new line 204: clever :) link swap
- removed unnecessary, old comments between lines <116..205>

Comments:
- effectiveness depends on the response from ytdlp.online: If something doesn't work, always check first status of YTDLP.ONLINE service.
- YT itag 18 is forced: video and audio together
- tested on: v.2.1 (nas/linux); v.2.3 (win64); v.2.4 (win64)

Tips:
- "Feed expiry interval [hours]": regardless of what the repeatedly modified plugin does, setting this Serviio option to 5h seems smart, because curently YT links exipres after 6h. It works for me.
- it is good practice, for any server platform, to restart Serviio service once every 24 hours: e.g. simple night batch with STOP/START and much less chance of any potential problems. It works for me.
- refresh time for "Online sources" can be relatively long: changes take time and become visible for DLNA terminals after some time (1min..1hour)
- if You experience too often e.g. YTDPL.ONLINE service overloads or domain unavailability, it is worth considering using a plugin based on LOCAL YT-DLP executable (easy installation for nas/linux/win/MacOS)


Kindly reminding - add online source as "Web Resource" and edit "Source URL" like this:

  Code:
https://www.googleapis.com/youtube/v3/search?q={YOUR_STRING_TO_FIND}&order=date //general SEARCHES
https://www.googleapis.com/youtube/v3/channels?id={CHANNEL_ID}&order=date //for channel ID
https://www.googleapis.com/youtube/v3/playlistItems?playlistId={PLAYLIST_ID}&order=date //for playlist ID

(... or anything that is YT api v3 compliant)

Examples for cool Polish cartoon series "Reksio":
  Code:
https://www.googleapis.com/youtube/v3/search?q=reksio+terapeuta+seria+reksio&order=date
https://www.googleapis.com/youtube/v3/channels?id=UCfXtDCs237pyDFCBIQR46yw&order=date
https://www.googleapis.com/youtube/v3/playlistItems?playlistId=PLdD_ZqnsrJc9MrHf_oMV_CwKVmlCrkoW1&order=date


where:

{YOUR_STRING_TO_FIND}= "reksio+terapeuta+seria+reksio"
{CHANNEL_ID}= "UCfXtDCs237pyDFCBIQR46yw"
{PLAYLIST_ID}= "PLdD_ZqnsrJc9MrHf_oMV_CwKVmlCrkoW1"



Thanks to YT-DLP Team, which handles the YT signature problem efficiently and smoothly for many, many years :)


Enjoj and You're welcome with requests, questions or suggestions: http://itx.cba.pl?s=Serviio :)
Attachments
Youtube.groovy
(17.17 KiB) Downloaded 3000 times
Last edited by it.x on Thu Jun 26, 2025 11:53 pm, edited 1 time in total.
<<

it.x

Serviio newbie

Posts: 7

Joined: Thu Aug 05, 2021 3:28 pm

Post Thu May 22, 2025 1:16 am

Re: YouTube

"YouTube.groovy" based on WEB YT-DLP tool, You can get for free ABOVE.

"YouTube.groovy" based on LOCAL YT-DLP executable, for symbolic fee, with AUTOMATIC FAST DELIVERY (24/7), is available here:

http://itx.cba.pl?s=Serviio_YouTube_plugin_based_on_YT-DLP_local_executable_AUTOMATIC_FAST_DELIVERY

Requirements:
- Your environment must have a working copy of Serviio Media Streaming Server :) and You have to make at least one dollar donation :)
- Your environment must have a working copy of YT-DLP executable and You must be able to point the path to it, by editing the indicated line in "YouTube.groovy" (text file).
- Your environment must be able to maintain normal Srviio loads + few instances of local YT-DLP executable: classic dual core machine is enough.

Delivery:
- You will receive an email with password protected link to plugin and short instruction (zip 6/20KB) after donating at least one dollar :)
- AUTOMATIC 24/7 email with crowdfunding service: buycoffee.to

Notice:
- changes made by me allow to use YouTube with Serviio since 2021 (first maintain Google data API v.3, next plugin based on YT-DLP tool) and please treat them as working bypass or template. Original version of script is published for free on this forum.
- tested on: v.2.1 (nas/linux); v.2.3 (win64); v.2.4 (win64)


I will be happy to answer any questions - feel free to ask.
Previous

Return to Available plugins

Who is online

Users browsing this forum: No registered users and 13 guests

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