Skip to content

Temporary(?) fix for #196#197

Closed
raitonoberu wants to merge 3 commits intokkdai:masterfrom
raitonoberu:master
Closed

Temporary(?) fix for #196#197
raitonoberu wants to merge 3 commits intokkdai:masterfrom
raitonoberu:master

Conversation

@raitonoberu
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Collaborator

corny commented Jun 21, 2021

Unfortunately two tests fail.

@raitonoberu
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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.

2 participants