Please look at the answer A102 on Tampermonkey's FAQs
I had a lot of saved items on Facebook and wanted to back them up to my PKM tool (Logseq) so I created a simple script to output all the links.
When a youtube playlist is open. This script can be used with right click context menu to output the titles and links to browser console. It uses video embed format of Logseq