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

[Feature Request] Channel Playlist JSON - Parse uploader & uploader ID from child playlist info #48

Closed
3 tasks done
undaunt opened this issue Feb 1, 2021 · 4 comments

Comments

@undaunt
Copy link

undaunt commented Feb 1, 2021

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running yt-dlp version 2021.01.29
  • I've searched the bugtracker for similar feature requests including closed ones

Description

Background Info

When running either a playlist or a channel search with JSON downloads enabled, the channel info itself is downloaded as one of the playlist JSON files. However, per your comment on https://github.com/pukkandan/yt-dlp/issues/36#issuecomment-769243923 being strikethrough now, I'm not sure if blank fields are skipped, written as null, etc. so I'm not sure if my request is possible.

When doing a channel download, the only playlist JSON that is downloaded is from the channel level. When doing a playlist download (either from /playlists or a direct playlist URL) the playlist JSON and the channel JSON are both downloaded.

The Ask

I'm wondering if we could auto parse the following fields and insert them into the channel level playlist JSON, perhaps based on the channel level playlist info webpage_url to redirect the parsing of information. Else, can we at least force mirror uploader, when blank, to equal title - this should only impact channel level playlists as everything else (regular playlists, videos, etc.) all have an uploader, right?

uploader
uploader_id
uploader_url

Eg: A regular playlist contains this data (relevant lines only snipped):

  "_type": "playlist",
  "id": "PLz3Be--ot61Mvmms68yBEhX6KrzPrqxsW",
  "title": "Dead Suns Character Intros",
  "uploader": "The Glass Cannon Network",
  "uploader_id": "UC83CJFLyDe72XgkKBd5a9IA",
  "uploader_url": "https://www.youtube.com/c/TheGlassCannon",
  "webpage_url": "https://www.youtube.com/playlist?list=PLz3Be--ot61Mvmms68yBEhX6KrzPrqxsW",

But the channel playlist data only contains this (relevant lines only snipped):

Playlist downloaded channel JSON

  "_type": "playlist",
  "id": "TheGlassCannon",
  "title": "The Glass Cannon Network",
  "webpage_url": "https://www.youtube.com/TheGlassCannon/playlists",

Channel downloaded channel JSON

  "_type": "playlist",
  "id": "TheGlassCannon",
  "title": "The Glass Cannon Network",
  "webpage_url": "https://www.youtube.com/TheGlassCannon",

For some reason, YouTube is returning the uploader info of the channel itself as null. Can we force it to auto-match all of the child playlist data? Right now, the only file that is being created outside of my parent `%(uploader)s% folder in an 'NA' folder is the channel information itself. Ideally I just want this to get dropped into the uploader folder somehow, separate from the subfolders where I'm dropping the playlists.

TL;DR - Can we force uploader, uploader_id, and uploader_url, when null, to either properly parse any of the channel's child playlists for good information on YouTube or, more simply, force uploader to equal title? Based on my output path below, it should wind up in the 'no playlist' channels folder.

Current output config

%(uploader)s/%(playlist_title)s - [%(playlist_id)s]/%(playlist_title)s - S01E%(playlist_index)s - %(title)s [%(id)s].%(ext)s
@pukkandan
Copy link
Member

Taking it from child playlists is not possible. I will check if it is extractable directly from the channel webpage.

Tip: If you want it done faster, you can help me, Go to the page in browser, open devtools, run window.ytInitialData and find the relevant info inside the object that you get

However, per your comment on #36 (comment) being strikethrough now, I'm not sure if blank fields are skipped, written as null, etc. so I'm not sure if my request is possible.

I removed that comment coz I realized that the behaviour is inconsistent. If the extractor sets the field to None, it shows as null, but if the extractor skips the field entirely, it is skipped in the JSON as well

@undaunt
Copy link
Author

undaunt commented Feb 2, 2021

The following values appear to match at the channel root, /playlists, and /videos

uploader_url seems to be the same as metadata, ownerUrls, 0
uploader_url also appears the same as metadata, vanityChannelUrl - though I imagine that won't be populated on all channels
uploader is the same as metadata, title
uploader_id is the same as metadata, externalID

@pukkandan
Copy link
Member

There is currently no way to distinguish a channel URL from a playlist one. So either we need such a way, or ensure that these fields won't cause trouble with playlists.

I'll be busy for a few hrs. Will try to fix this in the evening

@undaunt
Copy link
Author

undaunt commented Feb 2, 2021

These fields look good as well, thanks so much!

@undaunt undaunt closed this as completed Feb 2, 2021
nswanberg pushed a commit to nswanberg/yt-dlp that referenced this issue Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants