Closed tomshaffner closed 1 month ago
Expansion on the error I get, starting at the pytubefix level:
LiveStreamError Traceback (most recent call last)
Cell In[3], [line 26](vscode-notebook-cell:?execution_count=3&line=26)
[24](vscode-notebook-cell:?execution_count=3&line=24) # Download the video
[25](vscode-notebook-cell:?execution_count=3&line=25) yt = YouTube(f"https://www.youtube.com/watch?v={video_id}")
---> [26](vscode-notebook-cell:?execution_count=3&line=26) video_stream = yt.streams.filter(only_audio=True).first()
[27](vscode-notebook-cell:?execution_count=3&line=27) video_file_path = os.path.join(folder_path, f"{title.replace('/', '_')}.mp4")
[28](vscode-notebook-cell:?execution_count=3&line=28) video_stream.download(output_path=folder_path, filename=f"{title.replace('/', '_')}.mp4")
File c:\Users\shaff\anaconda3\envs\llm_env_311\Lib\site-packages\pytubefix\__main__.py:564, in YouTube.streams(self)
[558](file:///C:/Users/shaff/anaconda3/envs/llm_env_311/Lib/site-packages/pytubefix/__main__.py:558) @property
[559](file:///C:/Users/shaff/anaconda3/envs/llm_env_311/Lib/site-packages/pytubefix/__main__.py:559) def streams(self) -> StreamQuery:
[560](file:///C:/Users/shaff/anaconda3/envs/llm_env_311/Lib/site-packages/pytubefix/__main__.py:560) """Interface to query both adaptive (DASH) and progressive streams.
...
[359](file:///C:/Users/shaff/anaconda3/envs/llm_env_311/Lib/site-packages/pytubefix/__main__.py:359) raise exceptions.VideoUnavailable(video_id=self.video_id)
[360](file:///C:/Users/shaff/anaconda3/envs/llm_env_311/Lib/site-packages/pytubefix/__main__.py:360) elif status == 'LIVE_STREAM':
--> [361](file:///C:/Users/shaff/anaconda3/envs/llm_env_311/Lib/site-packages/pytubefix/__main__.py:361) raise exceptions.LiveStreamError(video_id=self.video_id)
LiveStreamError: _5bgku9j1Og is streaming live and cannot be loaded```
@JuanBindez We need to remove the"isLiveContent" check
From video:
"viewCount": "32",
"author": "Town of Huntersville, NC",
"isLowLatencyLiveStream": false,
"isPrivate": false,
"isUnpluggedCorpus": false,
"latencyClass": "MDE_STREAM_OPTIMIZATIONS_RENDERER_LATENCY_NORMAL",
"isLiveContent": true
},
Thanks, this was enough info for me to figure out my next step. For the moment in my own use case I just commented that check out in my package code and that worked great. Will look for a fix at some future point but I'm good for now; much appreciated!
Describe the bug Failed to download with error: _5bgku9j1Og: _5bgku9j1Og is streaming live and cannot be loaded
This occurs for a number of videos, including OPNEzAduzIc, qPu51wNto2k, and KSljLOY4p4k, among others, and in none of these cases is the video live streaming.
This error is thrown with this line:
yt.streams.get_audio_only()
Or this one:
yt.streams.filter(only_audio=True).first()
After setup with this line:
yt = YouTube(f"https://www.youtube.com/watch?v={video_id}")
In other cases it works fine and a subsequent audio download works great. Not here for some reason.