Home python Python youtube-dl. ERROR: No video formats found; WARNING: unable to extract player...

Python youtube-dl. ERROR: No video formats found; WARNING: unable to extract player URL;

Author

Date

Category

There is a Python program. One of its functions is to retrieve data about YouTube videos using the youtube-dl library. The program is installed on the hosting Heroku . There are problems with this library on hosting.

From time to time, when working with youtube-dl , failures occur, due to which the command stops executing and cannot get information.


An error occurs when extracting information from a video:

This is a complete reproducible example. If you run it on your computer, then everything will be ok. Launch on Heroku – errors from the library immediately fly. The versions are the same, everything is identical.

from youtube_dl import YoutubeDL
YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'False', 'forcetitle': True, 'quiet': True}
def get_data (url):
  if not url.startswith ('https: //'):
    with YoutubeDL (YDL_OPTIONS) as ydl:
      info = ydl.extract_info (f'ytsearch: {url} ', download = False)
    url = 'https://youtu.be/' + info ['entries'] [0] ['id']
  with YoutubeDL (YDL_OPTIONS) as ydl:
    info = ydl.extract_info (url, download = False)
  title = info.get ('title')
  id_ = info.get ('id')
  URL = info ['formats'] [0] ['url']
  return title, id_, url
urls = ['https://www.youtube.com/watch?v=ueiqUx19vxw&ab_channel=CarMusic', 'https://youtu.be/9TnyItDcFdE', 'https://youtu.be/5QCaaAyz-yA' , 'https://youtu.be/0S13mP_pfEc', 'https://youtu.be/5QCaaAyz-yA', 'a fly is also a helicopter', 'del shannon run away', 'smeshariki', 'https: // www .youtube.com / watch? v = RTFyrZo8Dns & amp; ab_channel = detras']
for i in urls:
  title, id_, url = get_data (i)
  print (f'URL: {i} \ nTitle: {title} \ nID: {id _} \ nRaw: {url} \ n \ n ')

I get the same error from time to time:

WARNING: unable to extract player URL; please report this issue on https://yt-dl.org/bug. Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug. Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

When I run it locally, on my computer – everything works, there are no questions.
This problem only occurs on hosting


Answer 1

The problem was resolved after today’s update 2021.4.1

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions