Add support for reversable filename format,filename -> url #5005

Closed
opened 2026-02-21 02:30:35 -05:00 by deekerman · 1 comment
Owner

Originally created by @wenerme on GitHub (Jul 4, 2015).

Consider youtube-dl have a predefined registry file

{
  "registries": [
    {
      "format": "www.youtube.com/watch?v=%s"
    },
    {
      "format": "www.bilibili.com/video/av%d/"
    },
    {
      "format": "www.bilibili.com/video/av%d/index_%d.html"
    }
  ]
}

For https://www.youtube.com/watch?v=zKN_pnzIM7k match the registry id #0
Save

World's Most Emotional & Powerful Music _ 2-Hours Epic Music Mix - Vol.1-zKN_pnzIM7k.f137.mp4

to

World's Most Emotional & Powerful Music _ 2-Hours Epic Music Mix - Vol.1-0zKN_pnzIM7k.f137.mp4

Notice there is one more char 0,use base64-like,one char for 64bit,it's enough to handle registry id(maybe can use some bits for other use).

For http://www.bilibili.com/video/av2403515/ match the registry id #1
Save to

Don't care the name-12403515.mp4

Consider there is a command

> youtube-dl --url 'Don't care the name-12403515.mp4'
http://www.bilibili.com/video/av2403515/

I thinks this is very useful.

The registry order should never change even the url format was changed,by add more meta info to registry will give more useful infos.

Originally created by @wenerme on GitHub (Jul 4, 2015). Consider youtube-dl have a predefined registry file ``` json { "registries": [ { "format": "www.youtube.com/watch?v=%s" }, { "format": "www.bilibili.com/video/av%d/" }, { "format": "www.bilibili.com/video/av%d/index_%d.html" } ] } ``` For `https://www.youtube.com/watch?v=zKN_pnzIM7k` match the registry id #0 Save ``` World's Most Emotional & Powerful Music _ 2-Hours Epic Music Mix - Vol.1-zKN_pnzIM7k.f137.mp4 ``` to ``` World's Most Emotional & Powerful Music _ 2-Hours Epic Music Mix - Vol.1-0zKN_pnzIM7k.f137.mp4 ``` Notice there is one more char `0`,use base64-like,one char for 64bit,it's enough to handle registry id(maybe can use some bits for other use). For `http://www.bilibili.com/video/av2403515/` match the registry id #1 Save to ``` Don't care the name-12403515.mp4 ``` Consider there is a command ``` > youtube-dl --url 'Don't care the name-12403515.mp4' http://www.bilibili.com/video/av2403515/ ``` I thinks this is very useful. The registry order should never change even the url format was changed,by add more meta info to registry will give more useful infos.
Author
Owner

@yan12125 commented on GitHub (Jul 4, 2015):

I think currently it's impossible. For most sites, it's impossible to infer the full URL from ID, as ID is only part of URL. For example, the following URL:

http://www.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm

has ID mission-impossible-outtakes

For sites that URL is directly related to ID (for example youtube and bilibili as you've mentioned), I think write a simple script that maps IDs to URLs and feeds the URL to youtube-dl is enough. A new feature is added to youtube-dl only if it's impossible or too complicated to implement it outside youtube-dl.

@yan12125 commented on GitHub (Jul 4, 2015): I think currently it's impossible. For most sites, it's impossible to infer the full URL from ID, as ID is only part of URL. For example, the following URL: ``` http://www.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm ``` has ID `mission-impossible-outtakes` For sites that URL is directly related to ID (for example youtube and bilibili as you've mentioned), I think write a simple script that maps IDs to URLs and feeds the URL to youtube-dl is enough. A new feature is added to youtube-dl only if it's impossible or too complicated to implement it outside youtube-dl.
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#5005
No description provided.