Skip to content

Instantly share code, notes, and snippets.

@s3rgeym
Last active April 17, 2026 13:04
Show Gist options
  • Select an option

  • Save s3rgeym/010d172e62fe62a57f63e7144e84e064 to your computer and use it in GitHub Desktop.

Select an option

Save s3rgeym/010d172e62fe62a57f63e7144e84e064 to your computer and use it in GitHub Desktop.
Promise.allSettled(
$$('.dWwPjl a').map(link => new Promise(async (resolve, reject) => {
try {
let response = await fetch(link.href)
let html = await response.text()
let doc = new DOMParser().parseFromString(html, 'text/html')
let directLink = doc.querySelector('.cmc-details-panel-links a')
resolve(directLink.href)
} catch (e) {
reject(e)
}
})
)).then(promisses =>
console.log(
promisses
.filter(p => p.status === 'fulfilled')
.map(p => p.value)
.join('\n')
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment