Skip to content

Instantly share code, notes, and snippets.

@Case104
Created October 9, 2023 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Case104/b4b6f31b9923069586eedc81da7f0053 to your computer and use it in GitHub Desktop.
Save Case104/b4b6f31b9923069586eedc81da7f0053 to your computer and use it in GitHub Desktop.
Update youtube script for Bryan
<%*
const url = await tp.system.clipboard();
const response = await fetch(`https://youtube.com/oembed?url=${url}&format=json`);
const {
title: rawTitle,
author_name: author,
author_url,
html,
thumbnail_url: thumbnail
} = await response.json();
const title = rawTitle.replace(/[<>:|?]/g, "");
const newPath = `Inbox/${title}`;
await tp.file.move(newPath);
const regex = /v=(.*)/gm;
const m = regex.exec(url);
console.log({ title, author, author_url, html, thumbnail, m });
-%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment