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

Issue with YouTube Shorts #36

Open
Aeron-Emory opened this issue Dec 29, 2024 · 2 comments
Open

Issue with YouTube Shorts #36

Aeron-Emory opened this issue Dec 29, 2024 · 2 comments

Comments

@Aeron-Emory
Copy link

Ayyyooo, I was tryna use this code but man... pytubefix gave me the time of my life with youtube short links. they keep failing (angry emoji), In the error code it said stuff like detected as bot... imma say I added the vid = pytube.YouTube(self.url, use_po_token=True) to downloader/youtube.py... but man... things still didn't go well. bruh, and then I tried to add the visitor data and stuff and still nothing...

TLDR: It requires po tokens now, and auto-gen for po tokens doesn't do the cut.

@amadejkastelic
Copy link
Owner

amadejkastelic commented Dec 29, 2024

Ayyyooo, I was tryna use this code but man... pytubefix gave me the time of my life with youtube short links. they keep failing (angry emoji), In the error code it said stuff like detected as bot... imma say I added the vid = pytube.YouTube(self.url, use_po_token=True) to downloader/youtube.py... but man... things still didn't go well. bruh, and then I tried to add the visitor data and stuff and still nothing...

TLDR: It requires po tokens now, and auto-gen for po tokens doesn't do the cut.

I have updated the pytubefix dependency. It seems to work fine for me. Can you test if you still need the token with latest main branch?

@Aeron-Emory
Copy link
Author

The issue didn't fix itself, I am still getting detected as a bot: This request was detected as a bot. Use use_po_token=True to view. See more details at https://github.com/JuanBindez/pytubefix/pull/209

2024-12-30 01:00:51,549 ERROR Failed downloading https://youtube.com/shorts/somelink This request was detected as a bot. Use `use_po_token=True` to view. See more details at https://github.com/JuanBindez/pytubefix/pull/209
2024-12-30 01:00:51,906 ERROR Ignoring exception in on_message
Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.12/site-packages/pytubefix/__main__.py", line 688, in title
    if 'title' in self.vid_info['videoDetails']:
                  ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'videoDetails'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.12/site-packages/discord/client.py", line 449, in _run_event
    await coro(*args, **kwargs)
  File "/app/bots/discord/client.py", line 73, in on_message
    raise e
  File "/app/bots/discord/client.py", line 66, in on_message
    post = await client.get_post()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/downloader/youtube.py", line 23, in get_post
    description=vid.title,
                ^^^^^^^^^
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.12/site-packages/pytubefix/__main__.py", line 724, in title
    self.check_availability()
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.12/site-packages/pytubefix/__main__.py", line 353, in check_availability
    raise exceptions.BotDetection(video_id=self.video_id)
pytubefix.exceptions.BotDetection: lDdm6Sqjv5s This request was detected as a bot. Use `use_po_token=True` to view. See more details at https://github.com/JuanBindez/pytubefix/pull/209 

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

No branches or pull requests

2 participants