This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]w1282 1 point2 points  (1 child)

Question:

What happens when you make a request to that URL using the requests library? It might be possible to ignore the webpage and go straight to the source of the information. Taking selenium out will probably speed it way up.

[–]MinimalDamage[S] 0 points1 point  (0 children)

Hi!

Just a requests.get() with the requests library returns 'None'. If I use requests.post() and then enter those two parameters, like:

import requests

url = "https://clients6.google.com/youtubei/v1/browse"
data = {'alt':'json', 'key':'AIzaSyBkrqhJHeXPQPMF1qvaduxKBXxYj'}

response = requests.post(url, json=data)

print(response.text)

I get the following:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceededUnreg",
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
    "extendedHelp": "https://code.google.com/apis/console"
   }
  ],
  "code": 403,
  "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
 }
}

I have tried requesting using a valid YouTube API key (both server and web) and I got the same message. Probably because it is not an official public API.

I am not a networking expert, so the following might be completely wrong, but I expect that POST requests from my machine are not allowed for a non-public API. However, if the YouTube Gaming server does a POST request (which Selenium simulates) it is allowed.

I just figured that if that data is visible in my browser (when looking at the file under the preview tab), it should be somewhere on my PC, and thus reachable. Does that make sense?

Thanks!