Sign in to follow this  
Followers 0
dmlarsen30

_INetGetSource and Instagram

6 posts in this topic

I'm working on a little script to snag full sized images off of Instagram.  I learned some time ago that the URL for IG photos was buried inside the page source. So, I've written a little script that examines the source of an Instagram page and extracts a full sized image to my hard drive.  It works great, but I've run into a small snag.  It seems that _INetGetSource works with some Instagram URLs, but not others, and I'm stumped as to why.  Consider the following:

#include <Inet.au3>

$URL1 = 'https://www.instagram.com/p/BHI5ZMtBy51/'
$URL2 = 'https://www.instagram.com/p/BJKLKFtDzYaLmsBoi_MiYTgUI70SEtB6L7ZdL40/'

ConsoleWrite(_INetGetSource($URL1, 1) & @CR)

ConsoleWrite("And then..." & @CR)

ConsoleWrite(_INetGetSource($URL2, 1) & @CR)

The first ConsoleWrite retrieves the page source just fine, while the last ConsoleWrite doesn't return anything and doesn't set error.

I know that Instagram does some funny things, and I can see that the second URL is much longer than the first one, but I can't see why it's not working.

If you have any insights, I'd love to hear them.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The second link  is broken, just tried to open in explorer a typical 404 site appears. Changing your script to

$sData=_INetGetSource($URL2, 1)
If @error Then
    ConsoleWrite(@error&@TAB&@extended&@CRLF)
Else
    ConsoleWrite($sData&@CRLF)
EndIf

i get:

And then...
13  0

 

If it's a dynamic created link you have to post the url which creating it.

Edited by AutoBert

Share this post


Link to post
Share on other sites

Thanks for your response, but as far as I know, the second link is not broken. When I cut and paste the URL into my chrome browser, I'm taken to the Instagram page for the image I'm trying to capture.   Weird....:mellow:

 

 

Share this post


Link to post
Share on other sites
35 minutes ago, dmlarsen30 said:

When I cut and paste the URL into my chrome browser, I'm taken to the Instagram page for the image I'm trying to capture.

When i cut and paste in FireFox i get a 404, maybe the url is in your Chromee-cache, but not in the IE-cache

Share this post


Link to post
Share on other sites

Fascinating....When I cut and paste the URL into IE, I get a 404 error too.  But, when I manually navigate back to my friends page, the URL is displayed as:

https://www.instagram.com/p/BJKLKFtDzYaLmsBoi_MiYTgUI70SEtB6L7ZdL40/

I have no idea what's going on, but there's definitely something odd about it.  

Oh well, perhaps I'll try another approach. It might make more sense for me to rewrite my script to control Chrome directly rather than using _InetGetsource.

Thanks very much for your help.

 

Share this post


Link to post
Share on other sites

I believe I've figured out what's going on. My friend has his account set to "private". I follow him and he follows me, so I had forgotten all about it. But, that explains why I can't use  _InetGetsource to access his page.

Again, thanks for your suggestions!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0