Drifty icon indicating copy to clipboard operation
Drifty copied to clipboard

[BUG] YouTube video link with playlist parameter is mistaken as playlist link

Open SaptarshiSarkar12 opened this issue 6 months ago • 67 comments

Describe the bug

A person clicked on a video from a YouTube playlist and when the link to the video is pasted in Drifty,

  • Drifty GUI tries to fetch the video name indefinitely. It also shows a popup window mentioning how many videos are there in the playlist but, it fails to download any. So, it keeps on detecting filename and computer heats up.
  • Drifty CLI shows an error that it fails to detect the filename and prompts the user to exit.

Steps To Reproduce

  1. Open Drifty GUI application.
  2. Paste a YouTube video link (containing both watch?v= and list= parameters), for example, this link - https://www.youtube.com/watch?v=uy_PEGgUF4U&list=PL0lo9MOBetEFGPccyxyfex8BYF_PQUQWn&index=1
  3. You can see that Drifty GUI tries to fetch the filename and the progress bar moves continuously indefinitely.
  4. Repeat the same in Drifty CLI to see that bug also.

Expected Behavior

Drifty must recognize that the URL is of a YouTube video and not of any playlists.

Screenshots

Drifty CLI

image

Drifty GUI

https://github.com/user-attachments/assets/db281ab2-10d2-4a25-811f-da45f78b4cad

Additional information

A regex match to identify if the provided link is a YouTube playlist or a specific YouTube video link, must be added. Yt-dlp fails to identify if a specific video is asked rather than the full playlist as seen when this code fragment is executed. https://github.com/SaptarshiSarkar12/Drifty/blob/3fff0e5e05a4fd871b50129aefff458ac246d59d/GUI/src/main/java/ui/GetFilename.java#L172-L192 A possible and reliable soluyion is to truncate the url upto the specific video id (the resultant url will be of the form https://www.youtube.com/watch?v=uy_PEGgUF4U).

If anyone wants to work on this issue, please comment below.

SaptarshiSarkar12 avatar Aug 15 '24 10:08 SaptarshiSarkar12