Jump to content


Photo

YouTube is down


  • Please log in to reply
48 replies to this topic

Re: YouTube is down #21 plecky

  • New Member
  • 2 posts

0
Neutral

Posted 25 March 2020 - 17:11

Of course I read messages above my reply. File YoutubeUi.pyo is in hexadeci code.

For normal conversion i use soft "Easy Python Decomplier", but soft can not conversion to back on hexadeci code.
I don't know how make  shell script for change the api key directly inside of the file. Thank s3n0  :) 
Just need to  only change "apy key", or  change next "Client secret" "Client ID"? I just changed  "apy key" and youtube works. :rolleyes:  :rolleyes: 
thanks to all



Re: YouTube is down #22 littlesat

  • PLi® Core member
  • 57,062 posts

+698
Excellent

Posted 25 March 2020 - 20:20

YOUTUBE_API_CLIENT_ID is 72 characters long. Do you think it can be entered normally with the remote in config?

then at least put them in a nice static config in /etc/enigma2/settings or special config file in that folder... to put it in the code is not that ‘smart’.... what I like at least is that you used thia method! I hope you can take a positive attitude from my comments...

Edited by littlesat, 25 March 2020 - 20:21.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: YouTube is down #23 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 26 March 2020 - 07:58

 

YOUTUBE_API_CLIENT_ID is 72 characters long. Do you think it can be entered normally with the remote in config?

then at least put them in a nice static config in /etc/enigma2/settings or special config file in that folder... to put it in the code is not that ‘smart’.... what I like at least is that you used thia method! I hope you can take a positive attitude from my comments...

 

Until now there was no problem with usage quotas, so there was no reason to place the API keys in a special file.
Therefore, the solution needed to be changed only now, when the problem appeared.
And I've already explained above why I didn't do it yet.
 
By the way, my plugin quota is 1.25 million requests per day. And they are spent in a few hours.
 
Yesterday I found the time and made changes in the plugin: https://github.com/T...9b05fa6c4406238
For Openpli I will make OAuth App Verification on google and after that offer changes in the image.


Re: YouTube is down #24 Tech

  • Forum Moderator
    PLi® Core member
  • 14,888 posts

+485
Excellent

Posted 26 March 2020 - 08:46

 

- simple shell script to change the api key directly inside of the file:

#!/bin/sh

KEY_OLD='AIzaSyCyIlbb0FIwoieEZ9RTShMVkRMisu-ZX0k'    # original YoutubeDL key
KEY_NEW='AIza_NewKey_NewKey_NewKey_NewKey_NewKey'    # new generated key - use YOUR OWN NEW generated API KEY
sed -i -e "s/$KEY_OLD/$KEY_NEW/I" /usr/lib/enigma2/python/Plugins/Extensions/YouTube/YouTubeUi.pyo

- or single line:

sed -i -e 's/AIzaSyCyIlbb0FIwoieEZ9RTShMVkRMisu-ZX0k/AIza_NewKey_NewKey_NewKey_NewKey_NewKey/I' /usr/lib/enigma2/python/Plugins/Extensions/YouTube/YouTubeUi.pyo

This is also a great and simple solution and in my humble opinion, there's nothing 'brrrr', it is a great solution for the people who don't know how to edit a pyo/py file


Aan de rand van de afgrond is een stap voorwaarts niet altijd vooruitgang....

On the edge of the abyss, a step forward is not always progress....

Hardware: 2x Daily used Vu+ Ultimo 4K - Vu+ Duo 4K SE and a lot more.... - VisioSat BiBigsat - Jultec Unicable Multiswitch 4 positions: 19.2/23.5/28.2 East - Diseqc motorized flatdish antenna

Software : HomeBuild OpenPLi Develop and Scarthgap builds, local cards driven by OsCam

Press the Posted Image button on the buttom right of this message ;)

Have you tried our wiki yet? Many answers can be found in our OpenPLi wiki


Re: YouTube is down #25 littlesat

  • PLi® Core member
  • 57,062 posts

+698
Excellent

Posted 26 March 2020 - 10:19


Until now there was no problem with usage quotas, so there was no reason to place the API keys in a special file.
Therefore, the solution needed to be changed only now, when the problem appeared.
And I've already explained above why I didn't do it yet.
 
By the way, my plugin quota is 1.25 million requests per day. And they are spent in a few hours.
 
Yesterday I found the time and made changes in the plugin: https://github.com/T...9b05fa6c4406238
For Openpli I will make OAuth App Verification on google and after that offer changes in the image.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: YouTube is down #26 littlesat

  • PLi® Core member
  • 57,062 posts

+698
Excellent

Posted 26 March 2020 - 10:21

I think hacking pyo/py files is still brrrrr. E.g. when reinstall the plugin (after a flash or so) you need to redo the poking patch stuff...

 


This is also a great and simple solution and in my humble opinion, there's nothing 'brrrr', it is a great solution for the people who don't know how to edit a pyo/py file


Edited by littlesat, 26 March 2020 - 10:21.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: YouTube is down #27 s3n0

  • Senior Member
  • 672 posts

+62
Good

Posted 26 March 2020 - 15:57

@littlesat yes, I am aware of that. But the YouTube plugin is not updated very often. :P

Of course, the most user friendly for Enigma is to use the "/etc/enigma2/settings" file (i.e. use the Enigma config module).

@Taapat don't be afraid to add the API_KEY string manually (via the keyboard - it doesn't matter that the string is too long) to the basic configuration menu.

The default API_KEY could remain as it is now. As a second option, it would be nice to add a directory browser to the configuration menu of the plugin (a more complicated solution), with the ability to find a file on disk and load API_KEY directly from that file (if any). Experienced users can easily edit the "/etc/enigma2/settings" file (while Enigme is stopped). Or again using Shell, via OpenWebif - there is a possibility to send a configuration item and its value to Enigma + save the settings again via OpenWebif (we've solved it here: https://forums.openp...l/#entry1180232 ).



Re: YouTube is down #28 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 26 March 2020 - 19:16

@s3n0 
I don't think that we need to change anything after the last changes.
The default API key remains, and in addition the user can save his API keys in /etc/enigma2/YouTube.key
I do not want to save them in /etc/enigma2/settings because in that case when you manually editing this file with errors, you destroy all enigma settings.
 
I think it would be best to hide the plugin API keys as it is intended by google.

I've been thinking about it, but I don't know how to implement this for plugin build from my open surce git for anyone without problems.



Re: YouTube is down #29 littlesat

  • PLi® Core member
  • 57,062 posts

+698
Excellent

Posted 27 March 2020 - 07:51

Good point taapat...
Maybe no keys or no key file show a notification with some instructions.... And no key in the plugin... note with misuse google can abandon the key.

Edited by littlesat, 27 March 2020 - 07:54.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: YouTube is down #30 kalehrl

  • Senior Member
  • 476 posts

+8
Neutral

Posted 27 March 2020 - 09:26

Down again.

Even when you add your own key.

'Error in creating entry list'



Re: YouTube is down #31 s3n0

  • Senior Member
  • 672 posts

+62
Good

Posted 27 March 2020 - 11:08

I propose to solve it as the creator of the KODI Youtube plugin:



You'll see an error that your YouTube developer account is not configured. Then you need to create an API key on your account and transfer this data to the Youtube plugin. Since KODI can copy and transfer text strings directly from the web, but in Enigma2, this is not possible, so these data could either be manually entered (although it is a lengthy process) or pasted via FTP to a file - folder "/etc/enigma2" (it doesn't matter if it is "settings" or "YouTube.key" file). However, in addition to API_KEY, other data will probably start changing. API_KEY may not be enough to change. Many users do not follow the proper procedure to make the API_KEY. The API_KEY then stop working for a third party sides over time. Or some users may to update (or flash) the system, along with the Youtube plugin and everything goes wrong :). Since the global API_KEY is no longer working, it may be completely removed from the YouTube plugin. As written by @littlesat, I suggest some MessageBox (info) announcing the need to add a custom developer API key, which the user must unfortunately create on their Youtube account. You can also include a link to the procedure on the website with screenshots (ideally not on Youtube, because I believe that Youtub will delete these videos over time, ha ha).


Edited by s3n0, 27 March 2020 - 11:11.


Re: YouTube is down #32 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 27 March 2020 - 13:50

My point is not to remove the keys.
My point is to reduce the load on plugins keys by allowing users and developers use their own keys. If the load does not exceed 1.25 million per day, ordinary users could use the plugin without creating their own keys.
I also assume, that my keys are being used elsewhere than in my plugin. And I would like to prevent this too.
 
But I don't want to implement any closed surce solutions.
I want if plugin to be able to build without problems from sources.


Re: YouTube is down #33 littlesat

  • PLi® Core member
  • 57,062 posts

+698
Excellent

Posted 27 March 2020 - 14:20

You also have a risk when your key does trigger the limits regular that youtube will abandon your key... so it is always better to let users use their own keys...


Edited by littlesat, 27 March 2020 - 14:20.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: YouTube is down #34 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 28 March 2020 - 16:42

@taapat,
 
In order to hide your client id and secret, maybe you can use a google cloud function.
 
https://medium.com/g...cp-19dd07e19824
https://cloud.google...nctions/pricing
 
You need to set requests in requirments.txt and handler as executing function.
 
No idea if the free trier will be enough....
 
 
import requests
import os
from flask import jsonify

YOUTUBE_API_CLIENT_ID = os.environ['YOUTUBE_API_CLIENT_ID']
YOUTUBE_API_CLIENT_SECRET = os.environ['YOUTUBE_API_CLIENT_SECRET']

def handler(request):
        user_agent = request.headers['user-agent']

        if request.method == 'GET':
                return f'YouTube Enigma2 API! %s' % user_agent
        elif request.method != 'POST':
                return f'YouTube Enigma2 API! %s' % user_agent

        request_json = request.get_json()
        if request_json and 'code' in request.args:
                return get_new_token(request_json['code'])
        elif request_json and 'refresh_token' in request_json:
                return get_access_token(request_json['refresh_token'])
        else:
                return get_user_code()

def get_user_code():
        url = 'https://accounts.google.com/o/oauth2/device/code'
        data = {'client_id': YOUTUBE_API_CLIENT_ID, 'scope': 'https://www.googleapis.com/auth/youtube'}
        try:
                resp = requests.post(url, data=data)
                resp.raise_for_status()
                data = resp.json()
                return jsonify(data)
        except requests.exceptions.HTTPError as err:
                data = {}
        return jsonify(data)

def get_new_token(device_code):
        url = 'https://accounts.google.com/o/oauth2/token'
        data = {'client_id': YOUTUBE_API_CLIENT_ID, 'client_secret': YOUTUBE_API_CLIENT_SECRET, 'code': device_code, 'grant_type': 'http://oauth.net/grant_type/device/1.0'}
        try:
                resp = requests.post(url, data=data)
                print(resp.text)
                resp.raise_for_status()
                #look for 'access_token' and return 'refresh_token' ...
                data = resp.json()
        except requests.exceptions.HTTPError as err:
                data = {}
        return jsonify(data)

def get_access_token(refresh_token):
        url = 'https://accounts.google.com/o/oauth2/token'
        data = {'client_id': YOUTUBE_API_CLIENT_ID, 'client_secret': YOUTUBE_API_CLIENT_SECRET, 'refresh_token': refresh_token, 'grant_type': 'refresh_token'}
        try:
                resp = requests.post(url, data=data)
                print(resp.text)
                resp.raise_for_status()
                # look for 'access_token' ....
                data = resp.json()
        except requests.exceptions.HTTPError as err:
                data = {}
        return jsonify(data)

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: YouTube is down #35 hispanico

  • Senior Member
  • 93 posts

+2
Neutral

Posted 28 March 2020 - 20:54

 

I have already generated these 3 keys. Problem.nam, because in my YouTube folder there is only YouTubeUI.pyo file and there is no YouTubeUI.py file

Just in case you want to solve the 'issue' by yourself instead of using the (great) service from FRAP.....

 

The needed files are not available because the sources from the youtube plugin are not installed.

You can install them by using a telnet client (putty) and type

enigma2-plugin-extensions-youtube-src

Just browse to the plugin folder and edit the py file, the pyo will be overwitten by the compiled (and edited) py when you restart enigma2.

 

I try but:
-bash: root@mutant51:~#: command not found
root@mutant51:~# -bash: enigma2-plugin-extensions-youtube-src: command not found
 
so wwhich the simple way to have plugin youtube plugin ok ?
and also in usr\lib\enigma2\python\Plugins\Extensions\YouTube\    i dont have YouTubeUi.py
 
Thank
Hispa

Edited by hispanico, 28 March 2020 - 20:59.


Re: YouTube is down #36 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 28 March 2020 - 21:28

@athoik if we do as google intends then i shouldn't offer any keys.
The builder should make verification on google and use their own keys for the plugin.

If anyone can get the keys from my application, and it doesn't matter in which way, then he can use them in his application to steal user data.

So while I allow for all build working plugin from my sources, I not see reason to hide keys in the hope that they will not be used for selfish purposes.

I can only try to reduce the load on the plugin keys because until it's not done they work only a couple of hours and are not normally usable.
Therefore, I hope other builders will use their own keys if this option is available.


Re: YouTube is down #37 s3n0

  • Senior Member
  • 672 posts

+62
Good

Posted 28 March 2020 - 21:40

@hispanico:

 

You can also to edit directly the .pyo compressed python file, i.e. without downloading the .py source file, read this: https://forums.openp...n/#entry1180688

If you read the whole discussion, you will also find a link directly to Taapat github from which you can download the YouTubeUi.py source file directly. Unfortunately, the source file has already been modified by Taapat (info below).

Although the use of modified YouTubeUi.py (if you change the API_KEY) also has its advantages and disadvantages - for example, it is not recommended that if you leave the .py file in the YouTube plugin directory, then each time you restart the Enigma, .py will be automatically translated to .pyo (and overwrite and so the original .pyo). So, although API_KEY will always be functional and rewritten, unfortunately even after a possible update to the YouTube plugin, the updated new version of the .pyo file will always be overwritten by your version of the .py file.

Taapat has already made some changes to the source code - https://github.com/T...rc/YouTubeUi.py on March 27, 2020. It is still in the development stage :). So now it depends on which version of Youtube plugin you are using :). If your Youtube plugin is old, then my procedure for Shell / "command line" should work simply. But if you are using new source code directly from Taapat from its github profile or you are using one of its new plugin code, then you must create a file /etc/enigma2/YouTube.key and insert the line:

API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

If you want rather this one "enigma2-plugin-extensions-youtube-src", so it is the installation package... so, you must install it also as package:

opkg update
opkg install enigma2-plugin-extensions-youtube-src

Edited by s3n0, 28 March 2020 - 21:49.


Re: YouTube is down #38 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 28 March 2020 - 21:58

@hispanico you can uninstall the plugin and install the latest plugin version from there: http://taapat.ho.ua/...plugin-youtube/
Here you can specify your keys in file /etc/enigma2/YouTube.key.
 
For now, I'm fight with google to verify the keys for Openpli, and until it's not finished I won't offer a changes on the Openpli feed.



Re: YouTube is down #39 hispanico

  • Senior Member
  • 93 posts

+2
Neutral

Posted 28 March 2020 - 22:08

https://raw.githubus...rc/YouTubeUi.py

 

ready-made file for editing

YEPPPPPPPPPPPP THANK FRAP

 

Follow you suggestions and now YOUTUBE OK !!!

Big Thank

Hispa



Re: YouTube is down #40 s3n0

  • Senior Member
  • 672 posts

+62
Good

Posted 29 March 2020 - 14:34

 

https://raw.githubus...rc/YouTubeUi.py

 

ready-made file for editing

YEPPPPPPPPPPPP THANK FRAP

 

Follow you suggestions and now YOUTUBE OK !!!

Big Thank

Hispa

 

This is no longer valid ... read also previous posts :). A new version of the Youtube plugin will be released. If API_KEY doesn't work for you, you need to create your own and put it in the "/etc/enigma2/YouTube.key" file.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users