Skip to content

Instantly share code, notes, and snippets.

@codewithcheese
Last active June 16, 2022 15:14
Show Gist options
  • Save codewithcheese/28f0c321e2dcb46ac69b1c4cf5cb2171 to your computer and use it in GitHub Desktop.
Save codewithcheese/28f0c321e2dcb46ac69b1c4cf5cb2171 to your computer and use it in GitHub Desktop.
Clip YouTube to Logseq
// make bookmarklet with https://promincproductions.com/devtools/bookmarklet-generator/
function clipVideo () {
const title = ytplayer.config.args.title;
const person = ytplayer.config.args.author;
const url = "https://www.youtube.com/watch?v=" + ytplayer.config.args.video_id;
const text = `- 🎥️\nTitle:: ${title}\nChannel:: ${person}\n\t- Embed\n{{video ${url}}}\n\t- Notes`;
const type = "text/plain";
const data = [new ClipboardItem({ [type]: text })];
navigator.clipboard.write(data).then(() => {
console.log("Clipped");
}).catch(err => {
console.error(err);
})
}
clipVideo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment