Skip to content

Instantly share code, notes, and snippets.

@danilvalov
Created December 14, 2017 13:04
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 danilvalov/cde1680ce3eabaeb41361d27db7286b5 to your computer and use it in GitHub Desktop.
Save danilvalov/cde1680ce3eabaeb41361d27db7286b5 to your computer and use it in GitHub Desktop.
Get instagram media array by tag
const request = require('async-request');
module.exports = async (tag) => {
try {
const response = await request(`https://www.instagram.com/explore/tags/${encodeURIComponent(tag)}/?__a=1`);
if (response.statusCode != 200) {
return throw response.statusCode;
}
try {
const jsonResponse = JSON.parse(body);
return jsonResponse.tag.media.nodes;
} catch (error) {
return throw error;
}
} catch (error) {
return throw error;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment