Per-site sections in the config file #24112

Open
opened 2026-02-21 13:09:58 -05:00 by deekerman · 4 comments
Owner

Originally created by @evelikov on GitHub (Jul 11, 2021).

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running youtube-dl version 2021.06.06
  • I've searched the bugtracker for similar feature requests including closed ones

Description

Currently the user can provide generic format settings in their $XDG_CONFIG_HOME/youtube-dl/config. Yet it's common to use different formats across different sites - can we have support for that?

Example and use-case:

cat $XDG_CONFIG_HOME/youtube-dl/config
# Generic section
--verbose
--format='best'

# The section identifier can be either the extractor name or a wildcard for the actual URL
# It's up-to the team to decide.
[youtube.com]
# say you want some websites to be audio-only
--format='bestaudio'

[dailymotion.com]
# sometimes the connection to the website is too slow for anything better
--format='best[height<=?720][fps<=?60]' 
Originally created by @evelikov on GitHub (Jul 11, 2021). <!-- ###################################################################### WARNING! IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE ###################################################################### --> ## Checklist <!-- Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl: - First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2021.06.06. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED. - Search the bugtracker for similar feature requests: http://yt-dl.org/search-issues. DO NOT post duplicates. - Finally, put x into all relevant boxes (like this [x]) --> - [x] I'm reporting a feature request - [x] I've verified that I'm running youtube-dl version **2021.06.06** - [x] I've searched the bugtracker for similar feature requests including closed ones ## Description <!-- Provide an explanation of your issue in an arbitrary form. Please make sure the description is worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient. Provide any additional information, suggested solution and as much context and examples as possible. --> Currently the user can provide generic format settings in their `$XDG_CONFIG_HOME/youtube-dl/config`. Yet it's common to use different formats across different sites - can we have support for that? Example and use-case: ``` cat $XDG_CONFIG_HOME/youtube-dl/config # Generic section --verbose --format='best' # The section identifier can be either the extractor name or a wildcard for the actual URL # It's up-to the team to decide. [youtube.com] # say you want some websites to be audio-only --format='bestaudio' [dailymotion.com] # sometimes the connection to the website is too slow for anything better --format='best[height<=?720][fps<=?60]' ```
Author
Owner

@dirkf commented on GitHub (Jul 12, 2021):

You could create a separate extra configuration file for each site or application.

Eg with dailymotion.conf containing

# sometimes the connection to the website is too slow for anything better
--format='best[height<=?720][fps<=?60]' 

then use youtube_dl --config-location dailymotion.conf ... 'http://dailymotion.com/...'

@dirkf commented on GitHub (Jul 12, 2021): You could create a separate extra configuration file for each site or application. Eg with `dailymotion.conf` containing ``` # sometimes the connection to the website is too slow for anything better --format='best[height<=?720][fps<=?60]' ``` then use `youtube_dl --config-location dailymotion.conf ... 'http://dailymotion.com/...'`
Author
Owner

@evelikov commented on GitHub (Jul 13, 2021):

I've considered that, but in practise it's no different than providing the --format line on each invocation.
Can give it a try and implement this, when I have some time.

Would the developers be in favour or against a PR for this?

@evelikov commented on GitHub (Jul 13, 2021): I've considered that, but in practise it's no different than providing the `--format` line on each invocation. Can give it a try and implement this, when I have some time. Would the developers be in favour or against a PR for this?
Author
Owner

@ghost commented on GitHub (Jul 18, 2021):

I've found this: #8901
It's kept stopping, unfortunately.

@ghost commented on GitHub (Jul 18, 2021): I've found this: #8901 It's kept stopping, unfortunately.
Author
Owner

@evelikov commented on GitHub (Jul 20, 2021):

Since found - thank you. Will have a closer look/respin.

@evelikov commented on GitHub (Jul 20, 2021): Since found - thank you. Will have a closer look/respin.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#24112
No description provided.