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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[extractor/youtube:comments] Deep check response for incomplete data #7148

Merged
merged 3 commits into from May 31, 2023

Conversation

coletdjnz
Copy link
Member

@coletdjnz coletdjnz commented May 28, 2023

YouTube may sometimes return no comments for a continuation

Authored by: coletdjnz

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Sometimes YouTube may return no comments for a continuation. This introduces a more throughout deep check for incomplete data to handle this case better.

Example: https://www.youtube.com/watch?v=d_n1qT9uEdU (newest and top sort)

TODO: more thorough testing

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 4f8c1e2

Summary

馃洜锔忦煍庰煑o笍

Improve YouTube comment extraction in yt_dlp/extractor/youtube.py by refactoring and enhancing the logic for finding and processing comment data.

Sing, O Muse, of the skillful coder who refined
The extraction of comments from YouTube's vast domain,
Defining a common path, a clear and constant guide,
To traverse the nested data with ease and without strain.

Walkthrough

  • Define a common path to access continuation items in YouTube responses (yt_dlp/extractor/youtube.py, link)
  • Pass a list of nested keys to check for comment data in responses, depending on the continuation type (yt_dlp/extractor/youtube.py, link)
  • Simplify the loop over continuation items by using the defined path and removing unused assignment (yt_dlp/extractor/youtube.py, link)

YouTube may sometimes return no comments for a continuation

Authored by: coletdjnz
@coletdjnz
Copy link
Member Author

Noticing it may throw some some more incomplete data errors where before youtube gave a continuation with no comments, then the following was the end (with no more comments)

@coletdjnz
Copy link
Member Author

coletdjnz commented May 28, 2023

issue: videos with no comments are throwing incomplete data errors fixed

@pukkandan pukkandan added the site-bug Issue with a specific website label May 28, 2023
@coletdjnz coletdjnz merged commit 18f8fba into yt-dlp:master May 31, 2023
11 checks passed
@coletdjnz coletdjnz deleted the fix/yt-no-comments branch May 31, 2023 07:08
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Deep check the response for incomplete data.

Authored by: coletdjnz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants