Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitch Clips: Is there an option to use the human readable ID as part of the Output Template? #29666

Closed
3 tasks done
suvis1 opened this issue Jul 27, 2021 · 2 comments · May be fixed by #29684
Closed
3 tasks done

Twitch Clips: Is there an option to use the human readable ID as part of the Output Template? #29666

suvis1 opened this issue Jul 27, 2021 · 2 comments · May be fixed by #29684
Labels

Comments

@suvis1
Copy link

suvis1 commented Jul 27, 2021

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Hi!

Im in the progress of archiving a huge amount of twitch clips, but i would require the human readable ID (e.g. GleamingGentleGarageJebaited-fapOh70bAsfNoU3C) to be saved in the filename. Youtube-dl itself considers the ID to be 1235515999 which wont work with what i need it to do. Ive tried all of the output %(NAME)s substitutions i could think of and nothing seems to be what im searching for.

Im not sure whether this is a new feature request or just me NOT seeing something that is possible, so i placed this under "question".

Thanks for any help :)

@dirkf
Copy link
Contributor

dirkf commented Jul 28, 2021

Looking at your example, which I assume is https://clips.twitch.tv/embed?clip=GleamingGentleGarageJebaited-fapOh70bAsfNoU3C&parent=cyberpost.co, the ID is initially recognised as GleamingGentleGarageJebaited-fapOh70bAsfNoU3C and then replaced by the ID returned from the GraphQL lookup.

The extractor could extract the original ID as display_id and it would then be available to you in the filename template, as below:

# youtube-dl -v --get-filename -o '%(display_id)s.%(ext)s' 'https://clips.twitch.tv/embed?clip=GleamingGentleGarageJebaited-fapOh70bAsfNoU3C&parent=cyberpost.co' 
[debug] System config: [u'--restrict-filenames', u'--prefer-ffmpeg', u'-f', u'best[height<=?1080][fps<=?60]', u'-o', u'/media/drive1/Video/%(title)s.%(ext)s']
[debug] User config: [u'-f', u'(best/bestvideo+bestaudio)[height<=?1080][fps<=?60][tbr<=?1900]']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-filename', u'-o', u'%(display_id)s.%(ext)s', u'https://clips.twitch.tv/embed?clip=GleamingGentleGarageJebaited-fapOh70bAsfNoU3C&parent=cyberpost.co']
[debug] Encodings: locale ASCII, fs ASCII, out ASCII, pref ASCII
[debug] youtube-dl version 2021.06.06.1
[debug] Python version 2.7.1 (CPython) - Linux-2.6.18-7.1-7405b0-smp-with-libc0
[debug] exe versions: ffmpeg 4.1, ffprobe 4.1
[debug] Proxy map: {}
GleamingGentleGarageJebaited-fapOh70bAsfNoU3C.mp4
#

For this, this line

            'display_id': video_id,

has to be added in the dict returned from the _real_extract() method of TwitchClipsIE, extractor/twitch.py line 976ff. Other extractors in the file do set display_id.

@suvis1
Copy link
Author

suvis1 commented Jul 28, 2021

Oh thanks so much for this! I already resorted to just putting the entire youtube-dl output to a variable and grepping the required lines out of it to change the filenames afterwards, but this is a much better solution that wont break as soon as even a single character gets added to the output lines haha :)

@suvis1 suvis1 closed this as completed Jul 28, 2021
dirkf added a commit to dirkf/youtube-dl that referenced this issue Jul 29, 2021
dirkf added a commit to dirkf/youtube-dl that referenced this issue Jul 29, 2021
pukkandan added a commit to yt-dlp/yt-dlp that referenced this issue Aug 4, 2021
Lesmiscore added a commit to ytdl-patched/ytdl-patched that referenced this issue Aug 5, 2021
* 'master' of https://github.com/yt-dlp/yt-dlp:
  Add regex to `--match-filter`
  Add all format filtering operators also to `--match-filter`
  [twitch:clips] Extract `display_id` PR: ytdl-org/youtube-dl#29684 Fixes: ytdl-org/youtube-dl#29666
  Handle `BrokenPipeError` PR: ytdl-org/youtube-dl#29505 Fixes: ytdl-org/youtube-dl#29082
  [ffpmeg] Allow `--ffmpeg-location` to be a file with different name
  Ensure sanitization of infodict before printing to stdout
  Fix `--compat-options filename` (#629)
  [Newgrounds] Improve extractor and fix playlist (#627)
  [nbcolympics:stream] Fix extractor
  [RCTIPlus] Support events and TV (#625)
nixxo pushed a commit to nixxo/yt-dlp that referenced this issue Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants