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

Entire response fails when chapters doesn't exist #139

Closed
richieM opened this issue Feb 28, 2023 · 2 comments
Closed

Entire response fails when chapters doesn't exist #139

richieM opened this issue Feb 28, 2023 · 2 comments
Assignees
Labels
bug Something isn't working medium priority A high-priority issue noticeable by the user but he can still work around it. quick A task that should take less than two hours to complete.

Comments

@richieM
Copy link

richieM commented Feb 28, 2023

If chapters are not defined for a video, the API endpoint returns junk -- either a 500 failure or a 200 with an empty response.
This presents a problem when asking for multiple parts , as the entire response fails...

To test, take two videos:
One with chapters -- https://www.youtube.com/watch?v=ygAqYC8JOQI
One without -- https://www.youtube.com/watch?v=OmnkUlh6fzo

Video with chapters, asking for chapters along with other data: success!
https://yt.lemnoslife.com/videos?part=id,status,contentDetails,mostReplayed,chapters&id=ygAqYC8JOQI

Video without chapters, asking for chapters along with other data, entire response fails [either a 500 or an empty 200 response]:
https://yt.lemnoslife.com/videos?part=id,status,contentDetails,mostReplayed,chapters&id=OmnkUlh6fzo

...and just as a sanity test, the video without chapters but asking for just non-chapters data is a success!
https://yt.lemnoslife.com/videos?part=id,status,contentDetails,mostReplayed&id=OmnkUlh6fzo

I imagine an appropriate fix might just return "chapters": null

Current workaround: One could ask for part=chapters in a separate request, but perhaps that's extra server overhead for your hosted API?

BTW, thanks for creating and maintaining this repo, its very useful and much appreciated.

@Benjamin-Loison Benjamin-Loison added bug Something isn't working medium priority A high-priority issue noticeable by the user but he can still work around it. quick A task that should take less than two hours to complete. labels Feb 28, 2023
@Benjamin-Loison Benjamin-Loison self-assigned this Feb 28, 2023
@Benjamin-Loison
Copy link
Owner

I am currently busy but I'll have a look at this issue in less than 2 weeks.

@Benjamin-Loison
Copy link
Owner

Benjamin-Loison commented Mar 1, 2023

Due to #28, passing multiple parts in a single request to an instance doesn't optimize that much compared to passing a part per request.

However the API should return a correct answer even if no data exist for the given resource, as specified in this issue comment.

Note that as chapters are encoded in a similar way as most replayed data, I also verified my patch on a:

I solved the issue in 6f412e9.

Thanks for reporting the issue and don't hesitate to reopen the issue if you consider it not solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working medium priority A high-priority issue noticeable by the user but he can still work around it. quick A task that should take less than two hours to complete.
Projects
None yet
Development

No branches or pull requests

2 participants