Skip to content

Instantly share code, notes, and snippets.

@c9s
Last active December 29, 2022 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/d33ac20f39f3f42b20096c84af2a38d3 to your computer and use it in GitHub Desktop.
Save c9s/d33ac20f39f3f42b20096c84af2a38d3 to your computer and use it in GitHub Desktop.
tweet text aggregator + eth wallet address
$$('main')[0].onclick = (e) => {
const re = /(0x[a-fA-F0-9]{40})/;
const addresses = [];
// const d = document.getElementsByTagName('main')
const els = document.querySelectorAll('[data-testid="tweetText"]')
const className = els[0].className;
const tweets = Array.from(document.getElementsByClassName(className));
console.log(`${tweets.length} tweets found`, tweets);
tweets.forEach((el) => {
const text = el.innerText
const matches = re.exec(text);
if (matches) {
addresses.push(matches[1]);
}
});
console.log(addresses);
const o = addresses.join("\n");
console.log(o);
navigator.clipboard.writeText(o);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment