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

[extractor/youtube] Extract channel_is_verified #7213

Merged

Conversation

coletdjnz
Copy link
Member

@coletdjnz coletdjnz commented Jun 3, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

ADD DESCRIPTION HERE

Adds new field channel_is_verified

This also fixes and tidies up a few other metadata extraction problems.

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 cbe19de

Summary

🛡️📊🎥

This pull request adds new features for YouTube extraction and testing. It enables yt_dlp to get and check the verification status of channels and videos, as well as the heatmap data of videos, from the YouTube platform. It also adds a new attribute channel_is_verified to the InfoExtractor class, which can be used by other extractors as well.

Sing, O Muse, of the skillful coder who devised
A clever way to mark the channels verified
By the mighty YouTube, whose videos he explored
With InfoExtractor, the base class he adored.

Walkthrough

  • Add a new attribute channel_is_verified to the InfoExtractor class and its subclasses, which indicates whether the channel that uploaded the video is verified on the platform (link, link, link, link, link)
  • Add a new enum value VERIFIED to the BadgeType class, which represents the verified badge that shows a check mark next to the channel name (link)
  • Move the definition of the _extract_badges method from the YoutubeBaseInfoExtractor class to the InfoExtractor class, and update the logic to handle different types of badge renderers and labels (link, link, link, link)
  • Update the methods that extract information from video, channel, comment, and sidebar renderers to use the _extract_badges method and the VERIFIED badge type, and to set the channel_is_verified attribute accordingly (link, link, link, link)
  • Update the test cases for the YoutubeIE, YoutubeTabIE, YoutubeSearchURLIE, and YoutubeConsentRedirectIE classes to include the channel_is_verified, comment_count, and heatmap fields in the expected dictionaries, and to match the current values of the dynamic fields (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Fix a bug where the badge_type variable was used instead of the label_badge_type variable in the _extract_badges method, and add a break statement to exit the loop once a match is found (link)
  • Fix a bug where the channel_handle variable could be None in the _extract_channel_renderer method, and try to extract the handle from the subscriberCountText field of the renderer (link)
  • Remove an outdated comment from the _extract_channel_renderer method (link)

@pukkandan
Copy link
Member

Pls merge as 2 commits. I want the addition of a new field to have its own clean commit. You can first merge all the cleanup except new field.

@pukkandan
Copy link
Member

Ans add to readme

@coletdjnz coletdjnz merged commit 1a76ecc into yt-dlp:master Jun 8, 2023
11 checks passed
@coletdjnz coletdjnz deleted the feat/youtube/channel_verified_metadata branch June 8, 2023 08:33
pukkandan pushed a commit that referenced this pull request Jun 8, 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
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants