Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
output template support for %(channel_id)s #9676
Comments
|
You can use |
|
No, this request is for a way to force the YouTube channel id (such as "UCLqxVugv74EIW3VWh2NOa3Q"), when there is also an uploader name. As noted above, when using %(uploader_id)s, and when the channel also has a user name, the name seems to have precedence over the channel id, and there doesn't appear to be a way to get the id ("UCLqxVugv74EIW3VWh2NOa3Q"). You get the uploader name instead of the id. |
|
Where are you getting that other string? Is that an internal Google ID? (And why would you want it anyway?) |
|
Ok, but every channel on YouTube also has an 'id' of the form "UCLqxVugv74EIW3VWh2NOa3Q", which is just as permanent as the 'uploader ID' your mention, and can be used interchangeably with it in URLs. It is easy to find this string in any respective YouTube HTML page, even if originating with the human-readable value. Just search for "channelId" and note the 24-character string that starts with 'UC'. As for why I want it, the 24-character format which starts with 'UC' is a consistent and predictable format which is identifiably associated with YouTube, for example when it appears as a (e.g.) local folder name mixed with other types of strings. That would not be true for the human-readable version of the "uploader ID". And also, remember that %(uploader_id)s already does exactly what I'm asking for here -- but only if there is no human-readable ID available. What doesn't seem helpful to me is the inconsistency in youtube-dl; there's essentially no way to predict whether you'll get a 24-character ID or otherwise when using %(uploader_id)s. Hence I propose %(channel_id)s that would always return an 'id' of the form "UCLqxVugv74EIW3VWh2NOa3Q" |
|
Ah right, I know what you are referring to now. I get those IDs for the I’m still not sure how it would be useful for downloaded videos. I for one would prefer to just see the uploaders’ names rather than some random string; that would make organization a lot easier, and is just as easy to sort. I debated whether even the named channel ID (e.g. I’m sure if you really need, they could probably add it, but there’s probably some more useful things that could be added like the the individual timestamp fields for more customizable timestamps. (Also, the |
|
It's useful for downloaded videos because you can use the output template to specify folder names in the full path leading to the target filename. You say that having the name "makes organization a lot easier," but as I noted above, I find exactly the opposite to be true for my application. When the downloaded files are managed by a file management program, it is better to have a unique folder identifier which has a well-understood fixed-width format, and is composed from a very limited ASCII character set (many channel names use e.g. Japanese, combining Unicode characters, etc.) |
|
bump? (apologies if doing so is considered rude; I don't know the culture here) |
|
Actually, it looks like this feature request is mostly solved by the new %(playlist_id)s capability which was recently added to the output template. Although the aforementioned keyword in fact returns the 24-character "playlist identifier" (UU...) of the channel, the "channel_id" is trivially obtained by changing the "UU" prefix to "UC." Unless someone feels like fixing the remaining glitch by adding %(channel_id)s to the template syntax as well (should be easy now, eh?), I guess this issue could be marked resolved. |
|
Sorry, looks like I spoke too soon. For operations on individual files, the playlist_id is returning "NA," a value which is not trivially converted to the proposed %(channel_id)s value :-( youtube_dl --simulate --o "/%(playlist_id)s/%(id)s.%(ext)s" --get-filename http://www.youtube.com/watch?v=BaW_jenozKc --> \NA\BaW_jenozKc.mp4 Obviously, that's not useful. As noted above, using %(uploader_id)s instead gives... --> \phihag\BaW_jenozKc.mp4 But this result is unpredictable: depending on the presence of a friendly name, you may or may not get the channel_id. What I continue to hope for of course, is... --> \UCLqxVugv74EIW3VWh2NOa3Q\BaW_jenozKc.mp4 This one is predictable because the channel_id is always available. Also, unlike the human-readable channel name which the user can change (I believe), the channel_id is fixed over the lifetime of the channel. This last point, which I don't think has been mentioned yet in this thread, is a compelling reason to add proper support for %(channel_id)s. So anyway, as far as I can tell, it remains impossible to specify this with the current output template options. |
|
I agree with the comments by glenn-slayden, and would like to see a He explained why the existing
I guess the code changes needed to add a new If the developers want people to do some testing of these change(s), I volunteer. I could also help by writing documentation. (I don't think much documentation will be needed, but if I'm wrong I'd be happy to write quite a lot.) |
DemoActualFor a quick demonstration of the apparent inconsistency of That inconsistency in directory naming is why I would like to have a new DesiredHere is what I would like to happen, if the feature is implemented: My Theory About YouTube "Channels"/"Users"Every uploader is a "channel", and can be accessed at URLs like these: If an uploader is also a "user", then YouTube mostly prefers to give you links to the "user" form of URLs. For example, even this search gives you this result. The exception is when you are on a video page, the link back to the uploader (just above the Subscribe button) always seems to be the "channel" form of URL. For example, at 5THOUSvpCKk, the link is: "Veritasium". A Look at Some Example "Channels" That Are Not "Users"The example I've already given was video UM96LYjO06E - from a random channel with just 2 subscribers, currently called GTMA GTMA. At the other end of the scale is The Weeknd - Topic - a singer with 1/4 million subscribers. Here is an Arabic channel: https://www.youtube.com/channel/UCrIy5XTmRPwZPOlilXDWacA |
|
I completely concur with Ectomind1990's comments and I still remain quite eager to have this issue fixed in the manner (s)he has so nicely described. |
|
Here is the complete code which fixes this issue if someone would like to propagate it to the master. All changes in 'extractor/youtube.py'. Line numbers are based on youtube-dl-master as of 12/23/2016, but should be obvious from context. The two changes (listed in reverse order in order to keep original line numbers valid) are as follows: extractor/youtube.dl, INSERT at line 1716: extractor/youtube.dl, INSERT at line 1413: With this change, you can specify %(channel_id)s in your output template, and you will consistently get the "UC..." identifier for both single item and playlist-oriented downloads. |
|
Some people who are interested in this feature request might also be interested in bug #12317 which affected the same area. Could it be worth checking that the proposed new channel_id field doesn't suffer from the same problem as the uploader_id? |
|
I was having the same problem, glad to see i was not alone. Will this be merged to master ? Having "channel_id" is more consistent than "uploader_id". |
|
@Piokaz The fix seems to have been rejected, so I am still privately using the mod shown above. |
|
I'd like to pile onto this one. I have an indexer that pulls YouTube metadata based on the naming of my folder structure. The channel: |
|
Please add this the channel ID is necessary for Plex plugins to properly scrape metadata from youtube. See here: https://github.com/ZeroQI/YouTube-Agent.bundle |
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like that [x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2016.06.02. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
The output template should have a way to reference the YouTube channel id, i.e.
%(channel_id)sCurrently,
%(uploader_id)sfalls back to rendering the channel id if the uploader doesn't have a name, but there's no way to force this behavior if the uploader does have a name.Note: If this feature is already available somewhere in youtube-dl, then I could not find it in the documentation, so documentation should be added or improved.