Skip to content

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

@SaptarshiSarkar12

Description

@SaptarshiSarkar12

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

File.Name.detection.going.on.for.indefinite.time.mp4

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.

String command = Program.get(YT_DLP);
String[] args = new String[]{command, "--flat-playlist", "--skip-download", "-P", dir, link};
ProcessBuilder pb = new ProcessBuilder(args);
pb.redirectErrorStream(true);
Process process = pb.start();
StringJoiner joiner = new StringJoiner(lineFeed);
try {
try (
InputStream inputStream = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))
)
{
String line;
while ((line = reader.readLine()) != null) {
if (this.isCancelled()) {
break;
}
joiner.add(line);
feedback.setValue(joiner.toString());
}
}

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.

Metadata

Metadata

Labels

App 💻Issues/Pull Requests which update Drifty Application CodeEddieHub:good-first-issueLabel for good-first-issue finder made by EddieHub Communitybug 🐛Issues/Pull Requests reporting/fixing a buggood first issueGood for newcomers

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions