I observe a lot of things and a lot of people, and I don’t step back while assuming certain things about anything that comes to my mind. Bad habit!
You might be wondering what those words have to do with the blog post. The answer is ~ This post is a result of the events happened in the past and are the outcomes of people’s actions.
I wish I could give the complete description of the event and mention the name of the people involved in the story!
Now, coming to the important thing. Sometimes you want to see someone’s Instagram stories, but in the past, you’ve been acting so desperate that you start to appear first in the list of those people “who watched the stories.” Oh shit!
You try to do something and somehow find a 3rd-party tool which you can use to view the Instagram stories. Boom! You stop checking their profile to see if they have uploaded any story. Okay, the problem is, you start to visit those 3rd-party apps multiple times in a day. Big time waste!
After a while, when you are happy not appearing in the list, the user starts to think “Why the hell this person isn’t checking my stories?” ~ Ten Open-ended questions nobody could answer.
The question bugs them so much that they get depressed and change the privacy of their profile, but you were such a big fuck that instead of acting smart, you check their profile immediately and end up viewing the story. The user notices this and gets to know about your sick mentality. Ouch!
Anyway, you could have saved your ass by acting smart. Here is the way I found to secretly view someone’s Instagram stories.
Before I being ~ Stalking is a bad thing, guys! I’m writing this because I had a good laugh when I saw someone struggling with Instagram and shit. I told him a hard way of checking user’s stories so that he realizes the time he wastes viewing stories of his crush. I’m not sure if he stopped, but I thoroughly enjoyed the whole incident.
I’m not sure if it had been previously done or not, but I discovered it a few weeks back while working on a client’s project. Okay, let’s go step by step, in the most boring way possible ~
⮞ Suppose your crush is Justin Beiber and you wanna stalk the hell out of her (mind your words, eh?). For the sake of maintaining the secrecy, we’ll first figure out the mechanism on another account (9geg) so that we don’t get caught while doing the most productive work on the Internet.
- Go to 9GAG
- Press
Ctrl + Shift + I
to open the Console. - Switch to the Network tab.
- Press
F5
to reload the page to record the network activity.
So, till now everything is going fine and we are on the right way to waste our time.
Now, when the page completely loads, clear the activities in the Network Tab, and without closing the Developer Console, click on 9GAG’s profile picture to load the stories. If you want, you can view all the stories otherwise that one click was enough for the next step.
When everything is done, you’ll get to see something similar ~
- Find the name that starts with
?query_hash
and click on it. - In the Header category under the General section (sorry, no reservation here), you’ll find Requested URL.
- Copy the URL that looks something similar to the below one and paste it in your text editor for future use (don’t copy the URL pasted below, it won’t work) ~
https://www.instagram.com/graphql/query/?query_hash=d2ab0364afbe46d0a04e487de893f919&variables=%7B%22reel_ids%22%3A%5B%22259220806%22%5D%2C%22tag_names%22%3A%5B%5D%2C%22location_ids%22%3A%5B%5D%2C%22highlight_reel_ids%22%3A%5B%5D%2C%22precomposed_overlay%22%3Afalse%7D
- Now, you can do two things ~
- Copy the response from the Response tab which is next to the Headers.
- or, paste the URL and make a request to see what you get.
- Either way, you’ll the same data which is in the form of
JSON
- Copy the whole response, paste it into your favourite Text Editor, and save it as
stories.json
Alright, now what to do? Of course, find the links which redirect towards the stories, but the question is ~ how many stories did the user upload? So, to get the number of stories that a user upload, we’ll do ~
So, there are 8 stories (seven videos and one image) uploaded by 9gag.
Okay, it’s time to find out the links of the images, but before, let’s check out the arrangement of data.
When you’ll type (in console)
> stories.data.reels_media[0].items[6]
you’ll see something similar ~
IMPORTANT NOTE ~ For items[6]
– We are taking the seventh item (story) from an array because other 7 out of 8 stories are videos. This is done for the sake of explanation.
Another thing – “seventh item” and “7 stories” ~ remember array indexing.
{ __typename: 'GraphStoryImage', id: '1859618471283064827', dimensions: { height: 1920, width: 1080 }, display_resources: [ { src: 'https://instagram.fdel11-1.fna.fbcdn.net/vp/4da9f9edc2bddcc7b73bd12aac4fbb20/5B8EE7D6/t51.12442-15/sh0.08/e35/p640x640/39887335_463907817446553_2051613101710639104_n.jpg', config_width: 640, config_height: 1137 }, { src: 'https://instagram.fdel11-1.fna.fbcdn.net/vp/2f03c39f92d708ec162ada9ad203288c/5B8EEC56/t51.12442-15/sh0.08/e35/p750x750/39887335_463907817446553_2051613101710639104_n.jpg', config_width: 750, config_height: 1333 }, { src: 'https://instagram.fdel11-1.fna.fbcdn.net/vp/d9d0e85bc1ba4c7c221649c7c5cc33f0/5B8EC6B1/t51.12442-15/e35/39887335_463907817446553_2051613101710639104_n.jpg', config_width: 1080, config_height: 1920 } ], display_url: 'https://instagram.fdel11-1.fna.fbcdn.net/vp/d9d0e85bc1ba4c7c221649c7c5cc33f0/5B8EC6B1/t51.12442-15/e35/39887335_463907817446553_2051613101710639104_n.jpg', media_preview: 'ABcq6RmCjJ6CoPtK/wCSP8anLYqPdQBKDnkUU1XDcCigCreTbEbacPxj1rm2llhxLlhuzg5znHB4yf1q5qyt5xYHoo/nj+ZFY+8ng8/40wOvtbuKdtsZyduT/n60Vk6KhWVs90/qKKQF680w3EhlDbcgDGM9M+49apf2G5OfM6/7P/166OigDLsdONq5cvuyuMYx3zmitSigD//Z', taken_at_timestamp: 1535903818, expiring_at_timestamp: 1535990218, story_cta_url: 'http://notsafeforwork.com', story_view_count: null, is_video: true }
So, display_resources
is the main object that contains all the links to one story inside an array, in different formats.
If 9gag has uploaded only one story which isn’t a video, but an image, then things would have been easy, as you’d do ~
> stories.data.reels_media[0].items[6].display_resources[0].src
and get the link –
https://instagram.fdel11-1.fna.fbcdn.net/vp/4da9f9edc2bddcc7b73bd12aac4fbb20/5B8EE7D6/t51.12442-15/sh0.08/e35/p640x640/39887335_463907817446553_2051613101710639104_n.jpg
You can copy-paste the link to download or view the story and the person.
Remember, 9gag has uploaded eight stories, but we have found the link to only one.
So, in order to find all the URLs of the stories, we need to loop through 8 times over the items ~
const stories = require('./stories.json'); const base = stories.data.reels_media[0].items; for (let i = 0; i < base.length; i++) { console.log(base[i].display_resources[0].src); }
which gives us ~
'https://instagram.fdel11-1.fna.fbcdn.net/vp/1ba2f219059389b7353a28d1ef9520d1/5B8E7F6A/t51.12442-15/e15/p640x640/39935146_2255454604691194_4798700731425095680_n.jpg' 'https://instagram.fdel11-1.fna.fbcdn.net/vp/66c3e85286655accb0d02d9edfcbd5e4/5B8EC20A/t51.12442-15/sh0.08/e35/p640x640/39298425_447366909083478_6175052585163030528_n.jpg' 'https://instagram.fdel11-1.fna.fbcdn.net/vp/c61e5a37755c85aca0e7b00e6db7131b/5B8F073F/t51.12442-15/sh0.08/e35/p640x640/39749556_298993300899831_9120405130850598912_n.jpg' 'https://instagram.fdel11-1.fna.fbcdn.net/vp/dd7db2fa07a22e7ab3fb0f700f697a9b/5B8E9010/t51.12442-15/sh0.08/e35/p640x640/40322285_2201814603434172_296314011408924672_n.jpg' 'https://instagram.fdel11-1.fna.fbcdn.net/vp/4151b5cdd48d0f9c2d4139d0eeb7f149/5B8ED6C7/t51.12442-15/sh0.08/e35/p640x640/39967315_474462536369246_1045130207867961344_n.jpg' 'https://instagram.fdel11-1.fna.fbcdn.net/vp/aedef7fe7ee72de559256ee3a1a9c5ae/5B8EC13F/t51.12442-15/sh0.08/e35/p640x640/39835986_255507775303669_7298938865308401664_n.jpg' 'https://instagram.fdel11-1.fna.fbcdn.net/vp/4da9f9edc2bddcc7b73bd12aac4fbb20/5B8EE7D6/t51.12442-15/sh0.08/e35/p640x640/39887335_463907817446553_2051613101710639104_n.jpg' 'https://instagram.fdel11-1.fna.fbcdn.net/vp/619aa8748c8267bbd0fcd0beff270c0f/5B8F07F9/t51.12442-15/e35/39812976_1125608844269529_5042458782811029504_n.jpg'
Part I of this blog would have been over if it was all about the images. But we’ve got to deal with something more, and a little bit more. Why? Because one of the content in the story is a video, but we’ve got the link only to the images, which includes the preview of the video.
~ THE GOOD AND THE BAD PARTS ~
The good thing is ~ If a user (here, 9gag) has uploaded images (only images) as their stories, then using the code written above, we can find the find the links to download/view the content. But if there are multiple stories with mixed formats of data (images/videos), then we have to do something else, right?
The bad things ~ Let’s find a way to fix the code and make it more flexible so that we don’t have to worry about if the data is video or image.
First thing first –
Getting back to the source which we saved earlier as stories.json
~
From the source, we can easily check if the story is in the form of the image or the video~
It means the third and the fifth story is a video, and the seventh story is an image. Good! Let’s modify our code accordingly so that it does what you want it to ~
const base = stories.data.reels_media[0].items; const list = {story: []}; for (let i = 0; i < base.length; i++) { const is = base[i].is_video; is === true ? list.story.push(base[i].video_resources[0].src) : list.story.push(base[i].display_resources[0].src); } console.log(list);
Result ~
{ story: [ 'https://instagram.fdel11-1.fna.fbcdn.net/vp/147a59d68983421ebba3191d7661b332/5B8EBA8D/t50.12441-16/40003484_237764973587653_247287981898256806_n.mp4', 'https://instagram.fdel11-1.fna.fbcdn.net/vp/34570a92cc5a64503658cf0eb4574121/5B8EFC68/t50.12441-16/40372865_470167603494761_1595378274132960111_n.mp4', 'https://instagram.fdel11-1.fna.fbcdn.net/vp/b9b727522442b5c68a41986cd6017acd/5B8EF46B/t50.12441-16/39392912_289670571831239_2007805170046493296_n.mp4', 'https://instagram.fdel11-1.fna.fbcdn.net/vp/cfe0ccb52430e300045596c392d92fba/5B8E8CC3/t50.12441-16/40396598_1939018936393147_3824116537426172204_n.mp4', 'https://instagram.fdel11-1.fna.fbcdn.net/vp/13ec6338fc565c6734e2c447e0ede083/5B8F0047/t50.12441-16/40450084_168355717397198_305780688795803085_n.mp4', 'https://instagram.fdel11-1.fna.fbcdn.net/vp/53e653b137b18bc114148afce1c59729/5B8F0618/t50.12441-16/40356443_470431510101833_8744124780132622327_n.mp4', 'https://instagram.fdel11-1.fna.fbcdn.net/vp/4da9f9edc2bddcc7b73bd12aac4fbb20/5B8EE7D6/t51.12442-15/sh0.08/e35/p640x640/39887335_463907817446553_2051613101710639104_n.jpg', 'https://instagram.fdel11-1.fna.fbcdn.net/vp/9fec659a5a669162aa28bd38d4d43409/5B8EF0CF/t50.12441-16/40202526_2052259681500094_1514968943413287243_n.mp4' ] }
Woohoo! Now we have the code which does the exact same thing we want so that we can easily collect the links without any hectic.
Save the code for the future use!
Part – II
Right before this, you got the URLs of the stories uploaded by 9gag, but the problem is ~ the moment you clicked on the profile picture to view the story, your name got added in the list of story viewers. Too bad.
Question ~ What’s the profit from everything I did?
Answer ~ You learned the mechanism to collect the links of the stories.
As of now, you have got the code in your text editor. All you need is the JSON data of the story uploaded by your crush (don’t forget Beiber’s name).
Problem ~ The act of anonymously viewing the stories of a user ends as soon as you click on the profile picture, and what we did previously is the same thing. In order to find the link which has something like “?query_hash
” as the parameter, we had to click on 9gag’s profile.
Solution ~ Yum Yum! (wait, what?)
- Remember we copied the URL about which I just talked about? Let’s bring it down here ~
https://www.instagram.com/graphql/query/?query_hash=d2ab0364afbe46d0a04e487de893f919&variables=%7B%22reel_ids%22%3A%5B%22259220806%22%5D%2C%22tag_names%22%3A%5B%5D%2C%22location_ids%22%3A%5B%5D%2C%22highlight_reel_ids%22%3A%5B%5D%2C%22precomposed_overlay%22%3Afalse%7D
After decoding, it looks like ~
https://instagram.com/graphql/query/?query_hash=d2ab0364afbe46d0a04e487de893f919&variables={"reel_ids":["259220806"],"tag_names":[],"location_ids":[],"highlight_reel_ids":[],"precomposed_overlay":false}
After breaking it down, we get ~
-
https://instagram.com/graphql/query/?
-
query_hash=d2ab0364afbe46d0a04e487de893f919&
-
variables = { "reel_ids":[ "259220806" ], "tag_names": [], "location_ids": [], "highlight_reel_ids": [], "precomposed_overlay": false }
I can wild guess that Instagram rotates the value of ?query_hash
, after a certain interval of time, but I’m not sure of it. In case, they don’t do it, it’s a good thing.
Looking at the query string parameters, we can see that "reel_ids"
holds the "user id"
of the account. Here, 259220806
is the user ID of 9gag. Great! It means we need valid query hash
and user ID
in order to download or view the Instagram stories of a user.
Okay, so we have figured out the way to get the required data, but we are only one step away from maintaining our anonymity while doing the most productive work. So, yeah, let’s do it ~
I talked about viewing Beiber’s Instagram stories, but right now, he hasn’t uploaded any. So, let’s test the process on some other account (You can choose your favourite).
- Open user’s profile ~ Andy Best (one of my favourite photographer on Instagram)
- Hit
Ctrl + u
- Hit
Ctrl + f
and search for"id":"
and you’ll find something like ~
"has_requested_viewer":false, "id":"482421524"
- Copy the digits.
Now, we have the ID of the user whose stories we wanna view without getting caught (gosh! I hate repeating the same thing)
So, previously we had already copied the URL which had the parameters like query_hash
and variables
. It’s time to use them for the goodness.
- Open your Text Editor
- Find
259220806
(since we tested everything on 9gag) - Replace it with the ID of the user you want to sneak on (in this case, it will be ~
482421524
- Copy and paste the URL into the browser to request the
JSON
data.
- Copy and save the data as
stories.json
and use the code we used above to extract all the URLs of the stories.
- Use those URLs to view/download the stories of the user and your name won’t come in the list of viewers. That’s it. You made it!
You can pin the tab and refresh the page after 20 hours in case you aren’t done stalking. Copy the code. Paste and save. Use the code. Copy the output. Check the stories with full anonymity.
You might be wondering what’s the point of doing all these things when you can view the story with one click? The answer is ~ Absolutely nothing.
Look at the blog’s title ~ “The hard way to secretly view Instagram stories!”
I could have simplified the whole process, but it’s not fun. Diving a little deep to understand what the fuck is going is kinda fun.
I hope you learned something from it. And please don’t waste your time sneaking around people’s profile.
~ Thank You ~