meeb / tubesync

Syncs YouTube channels and playlists to a locally hosted media server
GNU Affero General Public License v3.0
1.91k stars 121 forks source link

Download channel-related assets #139

Open ExodusC opened 3 years ago

ExodusC commented 3 years ago

It would be a useful (but I'm sure low-priority) enhancement to have TubeSync be able to pull down channel-related assets such as the banner, channel profile picture, "about" section. Having TubeSync index these assets and then pull down a new copy if they change, while retaining the old assets would also be extremely useful.

I could see media player front-ends maybe using some of these assets, but realistically though, it's more of an archival feature. Being able to capture this data for channels that run "events" involving temporarily re-branding the channel, etc. is useful for people trying to reconstruct the "lore" timeline of a given channel.

meeb commented 3 years ago

I have looked into this a bit. Realistically it's likely only going to be sensible to offer to index what youtube-dl returns in its metadata. Currently (and for some media only) that's occasionally a larger thumbnail and that's about it.

Some channels return a channel-level thumbnail image or logo. I'll check again but I'm pretty sure no other channel metadata is returned for indexing channels so I think banners and about info is missing. I probably won't have time to write and maintain any custom indexers to get channel level metadata but I'll have a look to see if anyone else has written some it might be sensible to piggy-back off of.

It's a nice idea and the only reason it's not already being pulled in is because it wasn't obviously available when indexing media.

There's a helper tool if you want to see what metadata youtube-dl returns for a URL. Drop into a shell in the TubeSync container and type:

./manage.py youtube-dl-info https://youtube.com/any-youtube-url

If it's a valid URL it'll spam the metadata returned to the console as JSON. That'll give you a reasonable idea of what data there is to easily work with without too much effort.

meeb commented 3 years ago

Actually, ignore the above. Looks like this may well be possible with upstream changes since I first looked at the data returned last year when I was playing with youtube-dl before starting TubeSYnc. I'll look into it more this week but yeah more hopeful it's possible now.

PhuriousGeorge commented 3 years ago

I've toyed with this a bit in the past for channel banner and user image. Ref https://stackoverflow.com/a/64306688. I don't think the format has changed and I never adapted the script to python (still a nub). At the time I was playing with this, youtube-dl didn't help.

meeb commented 3 years ago

Thanks @PhuriousGeorge - it looks like a bunch of channel metadata is now returned with the right API flags directly in more recent youtube-dl so hopefully maintaining regexes won't be required for this (one of my personal most hated things to do is maintain regexes for scrapers!). I'll poke into the changelog and see when this was added.