mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[GH-ISSUE #6208] issue: youtube video errors #68888
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zabirauf on GitHub (Oct 16, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/6208
Bug Report
Installation Method
Installed using Docker
Environment
Open WebUI Version: 0.3.32
Ollama (if applicable): 0.3.12
Operating System: Ubuntu 22.04
Browser (if applicable): Safari on Mac 15.0.1
Confirmation:
Expected Behavior:
Expect the Youtube video info to be extracted
Actual Behavior:
Something went wrong :/ Exception while accessing title of https://www.youtube.com/watch?v=LJbUaciFdV8. Please file a bug report at https://github.com/pytube/pytube
Description
Bug Summary:
Using #youtubeurl pretty consistently runs into following error
Reproduction Details
Steps to Reproduce:
Logs and Screenshots
Docker Container Logs:
@thiswillbeyourgithub commented on GitHub (Oct 16, 2024):
Wouldn't it be better if open-webui used ytdlp? I've had far better results with it for fetching youtube data.
@tjbck commented on GitHub (Oct 16, 2024):
Seems like pytube library is being unmaintained at the moment, PR welcome!
@rgaricano commented on GitHub (Oct 19, 2024):
maybe pytubefix? (more update lib)
https://github.com/JuanBindez/pytubefix
https://pypi.org/project/pytubefix/
@Varming73 commented on GitHub (Oct 20, 2024):
I have a similar problem (and I understand it's because of the usuage of pytube)
@Tweeeks commented on GitHub (Oct 21, 2024):
I think there is a way to fix it. Need to fork it and make some changes:
it pytube/cipher.py:
function_patterns = [
# https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-865985377
#
48416bc4a8# var Bpa = [iha];
# ...
# a.C && (b = a.get("n")) && (b = Bpa0, a.set("n", b),
# Bpa.length || iha("")) }};
# In the above case,
ihais the relevant function namer'a.[a-zA-Z]\s*&&\s*([a-z]\s*=\sa.get("n"))\s&&\s*'
r'([a-z]\s*=\s*([a-zA-Z0-9$]+)([\d+])?([a-z])',
]
# https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-865985377
#
48416bc4a8# var Bpa = [iha];
# ...
# a.C && (b = a.get("n")) && (b = Bpa0, a.set("n", b),
# Bpa.length || iha("")) }};
# In the above case,
ihais the relevant function namer'a.[a-zA-Z]\s*&&\s*([a-z]\s*=\sa.get("n"))\s&&.?||\s([a-z]+)',
r'([a-z]\s*=\s*([a-zA-Z0-9$]+)([\d+])?([a-z])',
r'([a-z]\s*=\s*([a-zA-Z0-9$]+)([\d+])([a-z])',
]
@Varming73 commented on GitHub (Oct 21, 2024):
I would like to test if needed, just tell me what you need me to do. Am running dockerized so that might limit it a bit.
@tjbck commented on GitHub (Oct 24, 2024):
Directly using yt-dlp sounds like would be the best option here like @thiswillbeyourgithub suggested. PR welcome!
@thiswillbeyourgithub commented on GitHub (Oct 25, 2024):
Well that's terrific timing I just fixed my rag app to use yt-dlp instead of relying on langchain's youtube loader that too crashed because of pytube.
Unfortunately I won't be available for the PR (not on a computer) but the code is in a single function here :
ab34e27088/wdoc/utils/loaders.py (L2221)Basically it downloads all the subtitles names. Then look for any of the subtitles corresponding to the accepted language code like en or fr. And it downloads the subtitle using the URL that is a value at this specific key. Then cleans the chapters and timecodes to save a lot of tokens. And store the result as a langchain Document.
I haven't thorougly tested it but it seemed fine and is at least a good start.
@grigio commented on GitHub (Oct 26, 2024):
+1 currently I'm using a workaround with
yt-dlp@VideoFX commented on GitHub (Oct 30, 2024):
I am also getting this error lately. Is there any more specifics/help on a fix/workaround?
@tjbck commented on GitHub (Nov 3, 2024):
Should be fixed on dev!
@spammenotinoz commented on GitHub (Nov 6, 2024):
Thank-you, confirming that YouTube is working fine in dev.