F
F
fleen2020-07-25 10:36:44
YouTube
fleen, 2020-07-25 10:36:44

Parsing the first youtube video when searching for PYTHON. How to do?

In general, you need to parse the first video when searching. The code looks something like this:

import requests
text = input("Введите текст для поиска: ")
url = "https://m.youtube.com/results?search_query="+text
r = requests.get(url)
data = r.text

And I have no idea how to proceed :(
Could you help, otherwise bs4 does not work
. Let me remind you that you need to parse the name and link of the first video

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Megum1n, 2020-07-25
@fleen

Use the API, don't reinvent the wheel.
https://developers.google.com/youtube/v3
Description of the search method:
https://developers.google.com/youtube/v3/docs/sear...
You need to execute a query that will immediately return you a list with the results.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question