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

Banner image is not taken into account #342

Open
Popolechien opened this issue Sep 23, 2024 · 6 comments
Open

Banner image is not taken into account #342

Popolechien opened this issue Sep 23, 2024 · 6 comments
Assignees
Milestone

Comments

@Popolechien
Copy link

Popolechien commented Sep 23, 2024

Looking at several of our latest Youtube channels I see that the banner image is never included in the corresponding zim file.

See, e.g.:

Youtube Zim
S2 Underground YT S2 zim
Voice of America YT VoA zim
Canadian prepper YT Canadian prepper ZIM
Astrolabe YT Astrolabe zim

Edit: this happens both when an entire channel or playlists within a channel are selected.

@benoit74 benoit74 self-assigned this Sep 23, 2024
@benoit74
Copy link
Collaborator

Thank you for reporting, this is indeed a problem.

@benoit74 benoit74 added this to the 3.2.0 milestone Sep 23, 2024
@benoit74
Copy link
Collaborator

This is in fact "normal" behavior, see

youtube/CHANGELOG

Lines 137 to 139 in 0b9bed5

## [2.1.11]
- removed banner retrieval due to API change

We can have a look again whether google changed again the API and we can retrieve the banner again.

@benoit74 benoit74 added enhancement and removed bug labels Sep 23, 2024
@dan-niles
Copy link
Collaborator

Unfortunately Google's API hasn't still changed to support retrieving banners again. As an alternative we could use something like BeautifulSoup to scrape the banner link off a channel and use it. I tested it with the code below:

import requests
from bs4 import BeautifulSoup
import json

channel_url = "https://www.youtube.com/@danasherniles"
response = requests.get(channel_url)
soup = BeautifulSoup(response.content, 'html.parser')

for script in soup.find_all("script"):
    if 'ytInitialData' in script.text:
        json_data = json.loads(script.text.split(' = ')[1].rstrip(';'))
        banner_url = json_data["header"]["pageHeaderRenderer"]["content"]["pageHeaderViewModel"]["banner"]["imageBannerViewModel"]["image"]["sources"][-1]["url"]
        print(banner_url)
        break

@benoit74
Copy link
Collaborator

Is this really worth it? I'm not against this, but it does look a bit fragile. And setting the banner image manually is not "that hard", so probably not the most priority issue to solve. That being said, I'm not against someone proposing a PR on this issue, just wondering which focus we should put on this issue.

@kelson42
Copy link
Contributor

kelson42 commented Oct 1, 2024

Is this really worth it? I'm not against this, but it does look a bit fragile. And setting the banner image manually is not "that hard", so probably not the most priority issue to solve. That being said, I'm not against someone proposing a PR on this issue, just wondering which focus we should put on this issue.

Yes, fragile... but seems to be the best we can do... and the banner is pretty important!

@benoit74 benoit74 modified the milestones: 3.2.0, 3.3.0 Oct 11, 2024
@benoit74 benoit74 modified the milestones: 3.3.0, backlog Nov 4, 2024
@benoit74
Copy link
Collaborator

benoit74 commented Nov 4, 2024

This will come back with move to full yt-dlp in fact (see #177), yt-dlp nicely provides the banner.

@benoit74 benoit74 modified the milestones: backlog, 3.4.0 Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants