Skip to content

Instantly share code, notes, and snippets.

@geongeorge
Last active May 7, 2020 16:05
Show Gist options
  • Save geongeorge/2992089b8fd66c597ae14f66894a6b82 to your computer and use it in GitHub Desktop.
Save geongeorge/2992089b8fd66c597ae14f66894a6b82 to your computer and use it in GitHub Desktop.
// Copy paste this in the console
(function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)})((function(a){const b=document.getElementsByTagName("meta");for(let c=0;c<b.length;c++)if(b[c].getAttribute("property")===a)return b[c].getAttribute("content");return""})("og:video"));
// bookmarklet
// https://jsfiddle.net/geongeorgek/5wbpshxz/2/
//get video url
(function (metaName) {
const metas = document.getElementsByTagName('meta');
for (let i = 0; i < metas.length; i++) {
if (metas[i].getAttribute('property') === metaName) {
return metas[i].getAttribute('content');
}
}
return '';
})('og:video');
//get url and copy to clipboard
var vidurl = (function(a){const b=document.getElementsByTagName("meta");for(let c=0;c<b.length;c++)if(b[c].getAttribute("property")===a)return b[c].getAttribute("content");return""})("og:video");
(function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)})(vidurl);
vidurl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment