ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.38k stars 9.96k forks source link

Pinterest extractor #30489

Open buddhhu opened 2 years ago

buddhhu commented 2 years ago

Checklist

Verbose log

[generic] 2r6NwmM: Requesting header
[redirect] Following redirect to https://www.pinterest.com/pin/37717715606719562/sent/?invite_code=e66fb34a61ef4d0b8770cbffd265f6ec&sender=682577024681855844&sfo=1
[Pinterest] 37717715606719562: Download Pin JSON metadata
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://pin.it/2r6NwmM']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.8.10 (CPython) - Linux-5.11.0-1022-azure-x86_64-with-glibc2.29
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4
[debug] Proxy map: {}
Traceback (most recent call last):
  File "/home/Blackmax/.local/bin/youtube-dl", line 8, in <module>
    sys.exit(main())
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/__init__.py", line 475, in main
    _real_main(argv)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/__init__.py", line 465, in _real_main
    retcode = ydl.download(all_urls)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 2068, in download
    res = self.extract_info(
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.__extract_info(url, ie, download, extra_info, process)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 847, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 885, in process_ie_result
    return self.extract_info(ie_result['url'],
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.__extract_info(url, ie, download, extra_info, process)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/extractor/pinterest.py", line 141, in _real_extract
    return self._extract_video(data)
  File "/home/Blackmax/.local/lib/python3.8/site-packages/youtube_dl/extractor/pinterest.py", line 38, in _extract_video
    for format_id, format_dict in data['videos']['video_list'].items():
TypeError: 'NoneType' object is not subscriptable

Description

I have tried with pip version as well as from source, and this error was raised in both build.

How to reproduce? youtube-dl https://pin.it/2r6NwmM

dirkf commented 2 years ago

When the metadata for pin id 37717715606719562, to which the problem URL redirects, is fetched, there are these critical items that show why yt-dl can't find any media:

  u'videos': None,
  u'is_video': False,

The extractor should test that the first value is not None before trying to extract a video so that it reports like this, instead of a type error:

[Pinterest] 37717715606719562: Download Pin JSON metadata
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.