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/mixch] Add comment extraction; update a test #9860

Merged
merged 3 commits into from
May 8, 2024

Conversation

pzhlkj6612
Copy link
Contributor

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

info_json:

  "comments": [
    {
      "author": "A",
      "author_id": 42,
      "id": "",  // could be an empty string
      "text": "...",
      "timestamp": 1700000000
    },
    {
      "author": "B",
      "author_id": 43,
      "id": "item-1984",
      "text": "...",
      "timestamp": 1700000001
    },

.

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?

@pukkandan
Copy link
Member

      "id": "",  // could be an empty string

This is not ideal. Is there any other key that could be used as ID?

@pukkandan pukkandan added the site-enhancement Feature request for some website label May 5, 2024
@pzhlkj6612
Copy link
Contributor Author

Hi, @pukkandan .

This is not ideal. Is there any other key that could be used as ID?

Unfortunately, there is no such key.

So, should we remove "id"?

Comment on lines 67 to 71
'author': ('name', {str_or_none}),
'author_id': ('user_id', {int_or_none}),
'id': ('message_id', {str_or_none}),
'text': ('body', {str_or_none}),
'timestamp': ('created', {int_or_none}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • It is better to have id=None than id="".
  • author_id should be returned as as a str, not int.
  • {TYPE_or_none} converts the data into TYPE while {TYPE} verifies the data is TYPE without converting

Considering these, I believe this is the proper impl:

Suggested change
'author': ('name', {str_or_none}),
'author_id': ('user_id', {int_or_none}),
'id': ('message_id', {str_or_none}),
'text': ('body', {str_or_none}),
'timestamp': ('created', {int_or_none}),
'author': ('name', {str}),
'author_id': ('user_id', {str_or_none}),
'id': ('message_id', {str}, {lambda x: x or None),
'text': ('body', {str}),
'timestamp': ('created', {int}),

Correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I must have been confused "{TYPE_or_none}" and "{TYPE}" at that time.

Fixed in 5bbd6c1.

"{str_or_none}" vs. "{str}"

Co-authored-by: pukkandan <pukkandan.ytdlp@gmail.com>
@bashonly bashonly merged commit b38018b into yt-dlp:master May 8, 2024
6 checks passed
@pzhlkj6612 pzhlkj6612 deleted the ie/mixch/live/comments branch May 9, 2024 00:37
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

3 participants