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

[ie/zaiko] add thumbnails from event pages #8054

Merged
merged 3 commits into from Sep 16, 2023
Merged

[ie/zaiko] add thumbnails from event pages #8054

merged 3 commits into from Sep 16, 2023

Conversation

pzhlkj6612
Copy link
Contributor

@pzhlkj6612 pzhlkj6612 commented Sep 7, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Hi.

This PR improves #7254.

This commit could not be finished without help of @c-basalt.

Different thumbnails?

The newly added thumbnail, which is from the event page, may be the same as the one of "poster_url", but not always. I participated in a live event that has two different thumbnails before. A thumbnail was shown first and contained something like "there's a special guest coming". The second thumbnail, a few days later, replaced the first one and contained that special guest's name and photo. Fans were pleasantly surprised.

The first thumbnail I saw looks like this:

20230907-yt-dlp-zaiko-thumbnail-cover-suprise

Local test

Unfortunately, the testing URL "ZAIKO STREAMING TEST" does not seem to work anymore, so I've tested the code with my own ticket only. I don't post the url because posting a real URL might give Zaiko a chance to find the user who shared their ticket.

{
    "id": "...",
    //...
    "thumbnails": [
        {
            "url": "https://d38fgd7fmrcuct.cloudfront.net/pf_1/1_3ybh***",
            "id": "1_3ybh***"
        },
        {
            "url": "https://media.zaiko.io/pf_1/1_3ybi***",
            "id": "1_3ybi***"
        }
    ],
> Get-FileHash *1_3yb*

Algorithm       Hash         Path
---------       ----         ----
SHA256          9B7***       ***
SHA256          C60***       ***
Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

Copilot Summary

🤖 Generated by Copilot at 7ad8088

Summary

✨🔨🔍

Added support for multiple thumbnails in zaiko.py. Extracted thumbnail URLs from different sources and assigned them IDs based on their filenames.

We'll scrape the web for thumbnails, me hearties, yo ho ho
We'll use the url_basename to name them as we go
We'll fetch them from the JSON and Open Graph, you see
And store them in the zaiko extractor, one, two, three

Walkthrough

  • Import url_basename function from utils module to generate thumbnail IDs from URLs (link)
  • Modify _real_extract function to collect two possible thumbnail URLs from player_meta and Open Graph tags (link)
  • Replace thumbnail field with thumbnails field in info_dict, using url_basename to create a list of dictionaries with id and url keys for each thumbnail (link)
  • Update test case to reflect the change from thumbnail to thumbnails field, and provide two expected thumbnail URLs (link)

The second thumbnail (from the event page) may be the same as the
  existing one, but not always.

Our test does not work, though.

This commit could not be finished without c-basalt.

Co-authored-by: c-basalt <117849907+c-basalt@users.noreply.github.com>
yt_dlp/extractor/zaiko.py Outdated Show resolved Hide resolved
yt_dlp/extractor/zaiko.py Outdated Show resolved Hide resolved
@bashonly bashonly added site-enhancement Feature request for some website pending-fixes PR has had changes requested labels Sep 9, 2023
pzhlkj6612 and others added 2 commits September 12, 2023 00:33
"_download_webpage(fatal=False)" could return "False".

Co-authored-by: bashonly <bashonly@bashonly.com>
Using "^https://[\w.-]+/\w+/\w+" to test URLs does not hurt too much.
The field "thumbnails" is ignored, see "sanitize_got_info_dict()".

Co-authored-by: bashonly <bashonly@bashonly.com>
@bashonly bashonly removed the pending-fixes PR has had changes requested label Sep 11, 2023
@bashonly bashonly added the pending-review PR needs a review label Sep 11, 2023
@pzhlkj6612
Copy link
Contributor Author

The comment in fee7e25 about "thumbnails" is wrong:

The field "thumbnails" is ignored, see "sanitize_got_info_dict()".

The real reason to add "thumbnail" back is that the field "thumbnail" will be generated from "thumbnails" in "process_video_result()", so the test will fail if no "thumbnail" specified.

@bashonly
Copy link
Member

Correct, but no worries about the message, commits will be squashed when merged

@bashonly bashonly removed the pending-review PR needs a review label Sep 16, 2023
@bashonly bashonly merged commit ecef42c into yt-dlp:master Sep 16, 2023
13 checks passed
@pzhlkj6612 pzhlkj6612 deleted the zaiko-2nd-thumbnail branch September 17, 2023 00:52
pzhlkj6612 referenced this pull request in c-basalt/yt-dlp Sep 17, 2023
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-enhancement Feature request for some website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants