You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to extract videos from a YouTube playlist that contains only Shorts(example: https://www.youtube.com/playlist?list=PLxPmekEwS6-bF6AWu3prP2iRltY6Oslrw) using the get_videos function with the playlistVideoRenderer parameter, the function fails to capture any videos. This issue does not occur with playlists containing regular videos or a mix of videos and Shorts.
Steps to Reproduce
Call the get_videos function with a playlist URL that contains only YouTube Shorts.
Use playlistVideoRenderer as the renderer parameter.
Iterate over the generator to yield videos.
Expected Behavior
The function should capture and yield videos from the playlist, regardless of whether they are Shorts or regular videos.
Actual Behavior
No videos are captured or yielded when the playlist consists solely of Shorts.
Solution
A conditional check was implemented to solve this issue. If no videos are captured with playlistVideoRenderer, the function will attempt to use reelItemRenderer instead. Here is the updated code snippet that addresses the problem:
videos=get_videos(url, api_endpoint, "playlistVideoRenderer", limit, sleep)
ifnotany(videos): # Check if the generator is emptyvideos=get_videos(url, api_endpoint, "reelItemRenderer", limit, sleep)
forvideoinvideos:
yieldvideo
The text was updated successfully, but these errors were encountered:
Issue Description
When attempting to extract videos from a YouTube playlist that contains only Shorts(example: https://www.youtube.com/playlist?list=PLxPmekEwS6-bF6AWu3prP2iRltY6Oslrw) using the
get_videos
function with theplaylistVideoRenderer
parameter, the function fails to capture any videos. This issue does not occur with playlists containing regular videos or a mix of videos and Shorts.Steps to Reproduce
get_videos
function with a playlist URL that contains only YouTube Shorts.playlistVideoRenderer
as the renderer parameter.Expected Behavior
The function should capture and yield videos from the playlist, regardless of whether they are Shorts or regular videos.
Actual Behavior
No videos are captured or yielded when the playlist consists solely of Shorts.
Solution
A conditional check was implemented to solve this issue. If no videos are captured with
playlistVideoRenderer
, the function will attempt to usereelItemRenderer
instead. Here is the updated code snippet that addresses the problem:The text was updated successfully, but these errors were encountered: