Skip to content

Instantly share code, notes, and snippets.

@clarkio
Last active September 20, 2018 16:06
Show Gist options
  • Save clarkio/169251660324d40a8f1cbbdd7c1f23a0 to your computer and use it in GitHub Desktop.
Save clarkio/169251660324d40a8f1cbbdd7c1f23a0 to your computer and use it in GitHub Desktop.
A Script to gather instagram account urls from a search query
1. Open the query URL in your browser with the search term you want to use
An example URL searching for dogs: https://www.instagram.com/web/search/topsearch/?context=blended&query=dog&rank_token=0.5831184414520498&include_reel=false
2. Copy the code in the "script.js" file
3. Open up your browser dev tools and go to the console
4. Paste in the code and hit Enter
// Example query URL: https://www.instagram.com/web/search/topsearch/?context=blended&query=dog&rank_token=0.5831184414520498&include_reel=false
// note: query=dog is what you will want to change for your search term
const igResults = document.getElementsByTagName('pre');
const accountsJson = JSON.parse(igResults[0].innerText);
const accountsUrls = accountsJson.users.map(account => `https://instagram.com/${account.user.username}`);
accountsUrls.forEach(url => console.log(url));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment