Skip to content

Conversation

BalliAsghar
Copy link
Contributor

Added Specs for yt-dlp

@withfig-bot
Copy link
Contributor

Overview

src/yt-dlp.ts:

Info:

Single Functions:

postProcess:

 function (out) {
    // Regex to identify YouTube URLs
    const regex = new RegExp(
      "^(https?://)?(www.)?(youtube.com|youtu.?be)/.+$",
      "gm"
    );

    try {
      // Check if the clipboard content contains YouTube URLs
      const matches = out.match(regex);

      if (!matches || matches.length === 0) return [];

      // Return each matched URL as a suggestion
      return matches.map((url) => {
        const isPlaylist = url.includes("playlist") || url.includes("list=");
        return {
          name: url.trim(),
          description: isPlaylist ? "YouTube playlist" : "YouTube video",
          icon: "https://www.youtube.com/s/desktop/810941b4/img/favicon_32.png",
        };
      });
    } catch (e) {
      console.error(e);
      return [];
    }
  }

URLs:

  • https://www.youtube.com/s/desktop/810941b4/img/favicon_32.png
  • https://sponsor.ajay.app
  • https://sponsor.ajay.app

@withfig-bot
Copy link
Contributor

Hello @BalliAsghar,
thank you very much for creating a Pull Request!
Here is a small checklist to get this PR merged as quickly as possible:

  • Do all subcommands / options which take arguments include the args property (args: {})?
  • Are all options modular? E.g. -a -u -x instead of -aux
  • Have all other checks passed?

Please add a 👍 as a reaction to this comment to show that you read this.

@BalliAsghar
Copy link
Contributor Author

anyone Reviewing this pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants