Created
October 9, 2023 19:36
-
-
Save Case104/b4b6f31b9923069586eedc81da7f0053 to your computer and use it in GitHub Desktop.
Update youtube script for Bryan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%* | |
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