Created
December 4, 2019 02:53
-
-
Save nkbt/f4be5035f618dbe9745906895bc2f6ef to your computer and use it in GitHub Desktop.
Instagram No-API Public posts access
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
content = await(await fetch('https://www.instagram.com/nkbtnk/')).text() | |
doc = new DOMParser().parseFromString(content, 'text/html') | |
dataEl = Array.from(doc.querySelectorAll('script:not([src])')).find(s => s.innerText.includes('window._sharedData = ')) | |
match = dataEl.innerText.match(/\{.+}/) | |
data = JSON.parse(match[0]) | |
last12posts = data.entry_data.ProfilePage[0].graphql.user.edge_owner_to_timeline_media.edges |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment