Last active
June 16, 2022 15:14
-
-
Save codewithcheese/28f0c321e2dcb46ac69b1c4cf5cb2171 to your computer and use it in GitHub Desktop.
Clip YouTube to Logseq
This file contains hidden or 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
// 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