Created
December 12, 2023 11:54
-
-
Save arlm/a39ed823d3fc25b0c1dfefb8fd828995 to your computer and use it in GitHub Desktop.
Find all embedded vimeo links on a page
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
// Find all links to vimeo.com on the page | |
const vimeoLinksInAnchorTags = Array.from(document.querySelectorAll('a[href*="vimeo.com"]'), link => link.href); | |
const vimeoLinksInIframeTags = Array.from(document.querySelectorAll('iframe[src*="vimeo.com"]'), iframe => iframe.src); | |
// Merge the arrays | |
const allVimeoLinks = [...vimeoLinksInAnchorTags, ...vimeoLinksInIframeTags]; | |
// Log the links to the browser console | |
allVimeoLinks.forEach(link => { | |
console.log(link); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment