yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
91.81k stars 7.14k forks source link

[bandcamp] Support video extraction #4241

Open MinePlayersPE opened 2 years ago

MinePlayersPE commented 2 years ago

Checklist

Region

Indonesia

Example URLs

https://gilvasunner.bandcamp.com/track/catch-that-ajit https://gilvasunner.bandcamp.com/video (list of videos)

Provide a description that is worded well enough to be understood

Bandcamp tracks may also be attached with a video alongside it's audio-only counterpart, but yt-dlp doesn't extract them. A user's video list is not recognized either

Image of the sample Bandcamp track's page alongside it's video preview (incase the iframe times out for some ppl)

Note that apparently, videos are uploaded separately from the music itself so they may have completely different contents

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

>yt-dlp -vUF "https://gilvasunner.bandcamp.com/track/catch-that-ajit"
[debug] Command-line config: ['-vUF', 'https://gilvasunner.bandcamp.com/track/catch-that-ajit']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.06.29 [9d339c41e] (source)
[debug] Lazy loading extractors is disabled
[debug] Plugins: ['SamplePluginIE', 'SamplePluginPP']
[debug] Git HEAD: 5c0dc6e60
[debug] Python 3.10.1 (CPython 64bit) - Windows-10-10.0.19043-SP0
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] Checking exe version: avprobe -bsfs
[debug] exe versions: ffmpeg N-106757-geef652ca9c-20220430 (setts)
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2021.10.08, mutagen-1.45.1, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.06.29, Current version: 2022.06.29
yt-dlp is up to date (2022.06.29)
[debug] [Bandcamp] Extracting URL: https://gilvasunner.bandcamp.com/track/catch-that-ajit
[Bandcamp] catch-that-ajit: Downloading webpage
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[info] Available formats for 3528137554:
ID      EXT RESOLUTION │ PROTO │ VCODEC     ACODEC  ABR
───────────────────────────────────────────────────────
mp3-128 mp3 audio only │ https │ audio only mp3    128k

>yt-dlp -vUF "https://gilvasunner.bandcamp.com/video"
[debug] Command-line config: ['-vUF', 'https://gilvasunner.bandcamp.com/video']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.06.29 [9d339c41e] (source)
[debug] Lazy loading extractors is disabled
[debug] Plugins: ['SamplePluginIE', 'SamplePluginPP']
[debug] Git HEAD: 5c0dc6e60
[debug] Python 3.10.1 (CPython 64bit) - Windows-10-10.0.19043-SP0
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] Checking exe version: avprobe -bsfs
[debug] exe versions: ffmpeg N-106757-geef652ca9c-20220430 (setts)
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2021.10.08, mutagen-1.45.1, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.06.29, Current version: 2022.06.29
yt-dlp is up to date (2022.06.29)
[debug] [generic] Extracting URL: https://gilvasunner.bandcamp.com/video
[generic] video: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] video: Downloading webpage
[generic] video: Extracting information
[debug] Looking for video embeds
ERROR: Unsupported URL: https://gilvasunner.bandcamp.com/video
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 1420, in wrapper
    return func(self, *args, **kwargs)
  File "yt_dlp\YoutubeDL.py", line 1490, in __extract_info
    ie_result = ie.extract(url)
  File "yt_dlp\extractor\common.py", line 640, in extract
    ie_result = self._real_extract(url)
  File "yt_dlp\extractor\generic.py", line 4130, in _real_extract
    raise UnsupportedError(url)
yt_dlp.utils.UnsupportedError: Unsupported URL: https://gilvasunner.bandcamp.com/video
MinePlayersPE commented 2 years ago

Constructing bandcamp's iframe URL via trackinfo and current data:

f'https://bandcamp.com/videoframe?video_id={track_info["video_id"]}&band_id={current["band_id"]}&from={track_info["video_source_type"]}'

(note that only video_id is actually needed) Extract the 23video iframe URL from the bandcamp iframe, and then you can pass it onto their extractor if the regex is changed

-_VALID_URL = r'https?://(?P<domain>[^.]+\.(?:twentythree\.net|23video\.com|filmweb\.no))/v\.ihtml/player\.html\?(?P<query>.*?\bphoto(?:_|%5f)id=(?P<id>\d+).*)'
+_VALID_URL = r'https?://(?P<domain>[^.]+\.(?:twentythree\.net|23video\.com|filmweb\.no))/(?:v|\d+)\.ihtml/player\.html\?(?P<query>.*?\bphoto(?:_|%5f)id=(?P<id>\d+).*)'
girlmaya commented 1 year ago

Would like to see this supported