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

Temporary(?) fix for #196 #197

Closed
wants to merge 3 commits into from
Closed

Temporary(?) fix for #196 #197

wants to merge 3 commits into from

Conversation

raitonoberu
Copy link

This PR adds some additional parameters to the URL, so that the request returns 200. I've copied them from pytube.

The new response is slightly different.

  • Video.Duration is now taken from prData.VideoDetails.LengthSeconds. I do not know why, but it is 1 second less than before, so I also changed the test.
  • Video.PublishDate is missing. Pytube fetches it from the video page, so I also added a regex to fetch in parseVideoPage. get_video_info doesn't return this information anymore.

Here is the output of go test: https://pastebin.com/9wQvwbJy

You have to decide what to do with the missing values.

Thanks.

For some reason, a different duration returned, that's why I changed client_test.go
@ghost
Copy link

ghost commented Jun 20, 2021

@raitonoberu it works for me. Thanks for the change.

For those who need this change immediately:

  1. Clone raitonoberu:master
  2. In your go project, run go mod edit -replace github.com/kkdai/youtube/v2=/location/for/raitonoberu:master
  3. You should revert this change once the PR goes in.

@corny
Copy link
Collaborator

corny commented Jun 21, 2021

Unfortunately two tests fail.

@raitonoberu
Copy link
Author

raitonoberu commented Jun 21, 2021

Yes, the tests fail because some data is missing. But this does not affect the operation of the package.
@corny, I need to consult with you as the main collaborator. Now I see 3 ways:

  1. We can make an additional request (watch?v=) to get the missing fields. An inefficient method.
  2. We can remove the missing fields from the Video struct. This may break backward compatibility.
  3. We can simply comment out failed tests. Then the PublishDate will always be "0001-01-01 00: 00: 00 +0000 UTC".

Another way is to stop using get_video_info. This may require a lot of rewriting and possibly API changes. It is possible that adding parameters may soon stop working, that's why this PR is "temporary".

Thanks.

@ghost
Copy link

ghost commented Jun 21, 2021

I'm able to download videos, but they don't have audio. Can anyone reproduce?

corny added a commit that referenced this pull request Jun 22, 2021
@corny
Copy link
Collaborator

corny commented Jun 22, 2021

closed in favour of #198

@corny corny closed this Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants