Last active
December 1, 2020 01:34
-
-
Save hamletbatista/b6424dac3801befbef56604a291cf2e3 to your computer and use it in GitHub Desktop.
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
//Extract Google Trends topics | |
//Usage: copy and paste in Chrome Javascript console with trending pages open. for example: | |
//https://trends.google.com/trends/trendingsearches/realtime?geo=US&category=all | |
function getTopics(){ | |
topics_anchors = document.querySelectorAll("div.details-wrapper > div.details > div.details-bottom > div.subtitles-text-wrapper.visible > div.summary-text > a"); | |
var topics = []; | |
for (topic of topics_anchors){ | |
console.log(topic.innerText) | |
topics.push(topic.innerText); | |
} | |
return topics; | |
} | |
#example output: | |
#["blink-182 & Lil Wayne announce co-headlining tour", "Duchess Meghan's royal baby is here and it's a boy, Buckingham Palace says", "Bookmakers suspend betting on royal baby birthdate amid speculation that Meghan has given birth", "Microsoft open-sources its quantum computing development tools", "Giants vs. Reds odds, line: MLB picks, predictions for May 6 from model on 73-51 roll", "St. Charles levee breach prompts evacuations", "Gina Rodriguez Marries Longtime Love Joe LoCicero", "Spider-Man: Far From Home's new trailer spoils Avengers: Endgame, explodes the MCU", "Wall Street falls after Trump's China tariff threat", "Wendy's is bringing back its spicy chicken nuggets…eet racked up more than 2 million likes in 2 days", "China State Funds Sought to Cushion Blow as Stocks Tumble", "S&P Metals & Mining SPDR (XME) Looking To Gain Traction: What the Technicals Reveal", "Sunscreens may enter bloodstream, but health effect unknown, study finds"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment