Re: YouTube
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)
Thanks to:
- https://stackoverflow.com/questions/676 ... -not-found
- https://stackoverflow.com/questions/256 ... ttp-client
Enjoj gratitude by any donation are welcome: https://zrzutka.pl/en/y4nk6p
Regards and good luck to Serviio Team