Skip to content

Instantly share code, notes, and snippets.

@eggplants
Created February 11, 2025 19:19
Show Gist options
  • Save eggplants/1594233c089ec525b8bd83943631833d to your computer and use it in GitHub Desktop.
Save eggplants/1594233c089ec525b8bd83943631833d to your computer and use it in GitHub Desktop.
Download a purchased video from https://online-ticket.yoshimoto.co.jp with yt-dlp
#!/usr/bin/env bash
# NOTE: FOR PRIVATE USE. DO NOT RE-UPLOAD DOWNLOADED VIDEOS.
# 1. Reveal source of video player's `<iframe id="video_iframe" ...>` to load window.dataForPlayer
# 2. Execute the following JS code in Developer console in the watching page of purchased video:
# const url = new URL(dataForPlayer.clips[0].config);
# url.origin + url.pathname.replace('/config', '');
# // => 'https://player.vimeo.com/video/<id>'
yt-dlp \
--referer 'https://online-ticket.yoshimoto.co.jp' \
'https://player.vimeo.com/video/<id>'
@eggplants
Copy link
Author

お試し視聴動画: https://online-ticket.yoshimoto.co.jp/products/trialvideo

// `dataForPlayer` is undefined in the watching page of sample video.
// After reveal source of video player's `<iframe id="video_iframe" ...>` to load window.playerConfig:
const url = new URL(playerConfig.video.embed_code.match(/(?<=src=")[^"]+(?=\?)/)[0])
url.origin + url.pathname.replace('/config', '');
// => 'https://player.vimeo.com/video/--snip--'

$ yt-dlp --referer 'https://online-ticket.yoshimoto.co.jp' 'https://player.vimeo.com/video/--snip--'
[vimeo] Extracting URL: https://player.vimeo.com/video/--snip--
[vimeo] --snip--: Downloading webpage
[vimeo] --snip--: Downloading akfire_interconnect_quic m3u8 information
[vimeo] --snip--: Downloading fastly_skyfire m3u8 information
[vimeo] --snip--: Downloading akfire_interconnect_quic MPD information
WARNING: [vimeo] --snip--: Failed to parse XML: not well-formed (invalid token): line 1, column 0
[vimeo] --snip--: Downloading fastly_skyfire MPD information
WARNING: [vimeo] --snip--: Failed to parse XML: not well-formed (invalid token): line 1, column 0
[info] --snip--: Downloading 1 format(s): hls-fastly_skyfire-1800+hls-fastly_skyfire-audio-low-Original
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 170
[download] Destination: お試し視聴動画 [--snip--].fhls-fastly_skyfire-1800.mp4
[download] 100% of  196.19MiB in 00:00:09 at 20.32MiB/s
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 170
[download] Destination: お試し視聴動画 [--snip--].fhls-fastly_skyfire-audio-low-Original.mp4
[download] 100% of   16.28MiB in 00:00:08 at 2.00MiB/s
[Merger] Merging formats into "お試し視聴動画 [--snip--].mp4"
Deleting original file お試し視聴動画 [--snip--].fhls-fastly_skyfire-audio-low-Original.mp4 (pass -k to keep)
Deleting original file お試し視聴動画 [--snip--].fhls-fastly_skyfire-1800.mp4 (pass -k to keep)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment