JuanBindez / pytubefix

Python3 library for downloading YouTube Videos.
http://pytubefix.rtfd.io/
MIT License
454 stars 67 forks source link

pytubefix.exceptions.LoginRequired: G17sBkb38XQ requires login to view #166

Closed glenn-jocher closed 1 month ago

glenn-jocher commented 1 month ago

We started getting this error in our most recent nightly CI for https://www.youtube.com/watch?v=G17sBkb38XQ, which is a public video that should not require any login.

This is with the latest ultralytics and pytubefix==6.9.2 versions. We've never seen this error before in the past.

https://github.com/ultralytics/ultralytics/actions/runs/10311409282/job/28553440131

Screenshot 2024-08-09 at 14 28 09

Reproduce

from ultralytics import YOLO

# Load the YOLO model
model = YOLO('yolov8n.pt')

# Run inference on the YouTube video
results = model(source="https://www.youtube.com/watch?v=G17sBkb38XQ")

# Process the results
for r in results:
    # Visualize the results on the frame
    r.show()
glenn-jocher commented 1 month ago

More info here, I'm not actually able to reproduce locally. Issue seems isolated to GitHub CI. Not sure what this means.

Screenshot 2024-08-09 at 14 47 39
Lexsah commented 1 month ago

Same issue here, for "https://youtu.be/50leN2_T8lo". Using the latest version too, running ubuntu on a VPS (so it's not linked to github)

image

rakshit-ti commented 1 month ago

Same issue here, for "https://youtu.be/50leN2_T8lo". Using the latest version too, running ubuntu on a VPS (so it's not linked to github)

image

Facing the same issue, looks like something changed at youtube's end:

"errorMessage": "\u001b[91mmqgIvkT6yV4 requires login to view\u001b[0m",
"errorType": "LoginRequired",
kundanjadhav commented 1 month ago

Hi All, I am also facing same issue from last 4 days. This issue is on AWS Lambda but not producible on Local setup. Any help is appreciated. @JuanBindez Please help.

KerolosAtef commented 1 month ago

Hello everyone, I also have the same issue with pytubefix==6.9.2 in my huggingface deployed model. MiniGPT4-video, but it runs normally in local

JuanBindez commented 1 month ago

Hi All, I am also facing same issue from last 4 days. This issue is on AWS Lambda but not producible on Local setup. Any help is appreciated. @JuanBindez Please help.

hello, take a look at #170

kundanjadhav commented 1 month ago

Hi, now getting error about bot detection. But is there any way to resolve this bot check issue and get download link as before? @JuanBindez

Function Logs START RequestId: 6586a56d-3e78-4926-bedb-f779a7584378 Version: $LATEST downloading.... unknows exception: VGums6GjUEA This request has been detected as a bot, please try again or log in to view END RequestId: 6586a56d-3e78-4926-bedb-f779a7584378 REPORT RequestId: 6586a56d-3e78-4926-bedb-f779a7584378 Duration: 160.76 ms Billed Duration: 161 ms Memory Size: 1024 MB Max Memory Used: 54 MB

Request ID 6586a56d-3e78-4926-bedb-f779a7584378

KerolosAtef commented 1 month ago

Hello @JuanBindez After the last update 6.10.2, I got this error: pytubefix.exceptions.BotDetection: DUT5rEU6pqM This request has been detected as a bot, please try again or log in to view

Is there any way to resolve this bot check issue ?

JuanBindez commented 1 month ago

Hello @JuanBindez After the last update 6.10.2, I got this error: pytubefix.exceptions.BotDetection: DUT5rEU6pqM This request has been detected as a bot, please try again or log in to view

Is there any way to resolve this bot check issue ?

hello, see this PR #170

KerolosAtef commented 1 month ago

Hi @JuanBindez I'm a little bit confused, what I understood from the mentioned PR that this bug has been fixed with the new version 6.10.2 , In my case I still have the error with this new version. you can see the error here in my deployed huggingface model MiniGPT4_video

kundanjadhav commented 1 month ago

Hi @JuanBindez

As many of us are still unable to fix this issue. I request you, can you explain steps in details to resolve this issue?

felipeucelli commented 1 month ago

This problem has already been discussed in #119 .

As there is still no solution for this, we can try authentication with oauth.

yt = YouTube('URL', use_oauth=True)

use_oauth=True will print a link and a code on the terminal, you must place the generated code in the link field provided. After confirming the account linking, just press "enter" on your keyboard and you will be authenticated.

This authentication process has already been discussed here #160.

WARNING

Don't use your main account as YouTube may ban it.

KerolosAtef commented 1 month ago

hello @felipeucelli I tried to use use_oauth=True in my deployed model in huggingface but got the same error pytubefix.exceptions.BotDetection: LA4L6GwnarY This request has been detected as a bot, please try again or log in to view

Also, I can't see the login process while using huggingface, when using use_oauth=True

felipeucelli commented 1 month ago

Hello @KerolosAtef, Try using a proxy to change your IP:

YouTube('URL', proxies=[YOUR PROXY])
JuanBindez commented 1 month ago

Hi @JuanBindez I'm a little bit confused, what I understood from the mentioned PR that this bug has been fixed with the new version 6.10.2 , In my case I still have the error with this new version. you can see the error here in my deployed huggingface model MiniGPT4_video

Hi, actually a bug was not fixed in this version but an exception feature was added for YouTube bot detection

tiago719 commented 2 weeks ago

Hello @KerolosAtef, Try using a proxy to change your IP:

YouTube('URL', proxies=[YOUR PROXY])

Any proxy service that you know will work? I've tried Bright Data, but I'm still unable to download youtube videos.

NannoSilver commented 2 weeks ago

Hello @KerolosAtef, Try using a proxy to change your IP:

YouTube('URL', proxies=[YOUR PROXY])

Any proxy service that you know will work? I've tried Bright Data, but I'm still unable to download youtube videos.

I am testing proxies. For proxies of the same vendor, some IPs are not detected as BOT, other have 100% detection, and others sometimes are detected as BOT, sometimes are not detected. There is no rule. Those with 100% detection I am asking the vendor to replace.

tiago719 commented 2 weeks ago

Hello @KerolosAtef, Try using a proxy to change your IP:

YouTube('URL', proxies=[YOUR PROXY])

Any proxy service that you know will work? I've tried Bright Data, but I'm still unable to download youtube videos.

I am testing proxies. For proxies of the same vendor, some IPs are not detected as BOT, other have 100% detection, and others sometimes are detected as BOT, sometimes are not detected. There is no rule. Those with 100% detection I am asking the vendor to replace.

What vendor has the best results so far?