Skip to content

Instantly share code, notes, and snippets.

@geshan
Created August 18, 2018 23:22
Show Gist options
  • Select an option

  • Save geshan/378be819646682c715e38a653c680401 to your computer and use it in GitHub Desktop.

Select an option

Save geshan/378be819646682c715e38a653c680401 to your computer and use it in GitHub Desktop.
domain-shortlist-to-ids
urls = $$('a.listing-result__address');
links = [];
ids = [];
for (url in urls) {
links.push(urls[url].href.split('-'));
}
for(linkArr of links) {
ids.push(linkArr[linkArr.length - 1]);
}
console.log(ids.join());
@geshan

geshan commented May 24, 2025

Copy link
Copy Markdown
Author

urls = $$('a');
links = [];
for (url in urls) {
const href =urls[url].href;
console.log(href);
if (href.startsWith('https://react.dev/learn')) {
links.push(href);
}
}
console.log(links)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment