dvingerh / PyInstaStories

Python script to download Instagram stories from Instagram users.
MIT License
330 stars 74 forks source link

1440px for Regular Posts #14

Closed remlap closed 5 years ago

remlap commented 5 years ago

Hi I am wondering what do you use to get regular posts in 1440px now it has been rolled out?

Thanks

dvingerh commented 5 years ago

Can you show an example of a post with those new image dimensions?

This script uses the instagram-private-api library which communicates with the private app API directly, so changes regarding available image versions shouldn't require any updates on my part.

remlap commented 5 years ago

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

I am currently using instaloader which does not support it, I have been using your live downloader for a long time now so your stories version is a huge plus it supports the new 1440.

https://scontent-frt3-1.cdninstagram.com/vp/9f2a44a0c69e6686b4dd7f1bb29be29f/5D70D382/t51.2885-15/e35/60320703_465167720970645_7302803485499276975_n.jpg?_nc_ht=scontent-frt3-1.cdninstagram.com&se=7&ig_cache_key=MjA0MDIyMDYxODIxMzAxMDAxNA%3D%3D.2&ig_cache_prefix=full_size_

A friend linked me this from GBinsta android app.

dvingerh commented 5 years ago

I haven't come across any stories yet with 1440px width if I understand correctly, the maximum dimensions available in the JSON response given by the app API are 1080x2129 in my experience.

As for regular posts, I use a script of my own to download media from individual profiles which is not on GitHub at this time.

It uses the same library to fetch posts and stories (it downloads both) and supports downloading 1440px images. Note that it will only fetch the last 12 posts on a profile so you won't be able to scrape anything like hashtags or complete profiles with it.

I've uploaded it as a private gist so you may use it if you like.

I believe scripts like InstaLoader and rarcega's Instagram scraper use the web API to scrape media, which doesn't display any 1440px images at the moment.

remlap commented 5 years ago

Your stories app is getting 1440x2650.

I grabbed this from mollycaitlynquinn https://i.imgur.com/rgw9W5b.jpg

I'll check out the private git you just linked!

dvingerh commented 5 years ago

Your stories app is getting 1440x2650.

Nice :)

I recently stripped some code from the script so certain imports like asyncio shouldn't be required anymore (forgot to remove these). Installing any other missing stuff you can easily do with pip, if need be.

remlap commented 5 years ago

Your private git works perfectly from what I can see it is stories and posts rolled into one and works really well!

dvingerh commented 5 years ago

Glad to hear! I'll close this issue, but if you have any more questions feel free to leave a comment here.

github-userx commented 5 years ago

@notcammy Do You know how I can download one particular Instagram video (url) in highresolution instead of only 240p?

dvingerh commented 5 years ago

@notcammy Do You know how I can download one particular Instagram video (url) in highresolution instead of only 240p?

Each video quality version has a different filename/url. You can't simply change a value to get a different quality video.

This script downloads the highest available story quality through the Instagram API. If you're unsure of the version it has downloaded you can look the file up by looking through the video_dash_manifest and video_versions keys of the object associated with the story in the feed_json.json file.

github-userx commented 5 years ago

@notcammy i want to download particular videos from regular ig posts (not stories). Can your python script do this? What do I have to add or change / enter any parameters, credentials?

The videos I want are within a users timeline of more than 1000 posts

dvingerh commented 5 years ago

No, this script is for story downloading only. Look into other projects available on Github if you haven't already. https://github.com/instaloader/instaloader https://github.com/rarcega/instagram-scraper

github-userx commented 5 years ago

Thanks, instaloader also only gets SD video quality ;( not 720p and 1080p

dvingerh commented 5 years ago

I have not seen any instagram video posts with dimensions higher than 720px in width or 900px in height. Can you give some examples of video you want to download.

github-userx commented 5 years ago

Try shortcode: BqPch1Yg_P9

dvingerh commented 5 years ago

I will take a proper look at it in the weekend. But after a quick glance I don't believe this video is any higher resolution than others.

github-userx commented 5 years ago

Bless you, many thanks. Very much looking forward to your findings!

dvingerh commented 5 years ago

The maximum dimensions for that video are 640x360. JSON response

Came across a video that has higher dimensions (960x540, https://www.instagram.com/p/B1cR5PHI4JA/) but I seriously doubt there are videos with dimensions much closer to 720/1080p.

github-userx commented 5 years ago

Many thanks! So probably the original quality was already not high...or IG is heavily downsizing Resolution&quality 

github-userx commented 5 years ago

@notcammy instaloader only gets 480x270 version of the one you posted the json output. So how do we get the 640x360 version?

github-userx commented 5 years ago

I wonder if live-streaming has similar restrictions

dvingerh commented 5 years ago

Many thanks! So probably the original quality was already not high...or IG is heavily downsizing Resolution&quality

Instagram already heavily compresses and resizes image files to maximum 1440px no matter how high the original image dimensions were. I suppose the similar conditions apply to video no matter the original video quality.

instaloader only gets 480x270 version of the one you posted the json output. So how do we get the 640x360 version?

Instaloader seems to be web based scraper. It downloads videos based on video_url attribute value (there are no other relevant attributes). I chose to use the app API for my projects because it returns more extensive json info, including multiple media quality versions.

I wonder if live-streaming has similar restrictions

Instagram will (under ideal connection conditions) compress and resize livestreams to 504x992 with roughly 1000kb bitrate.

github-userx commented 5 years ago

Yes instaloader indeed uses the web api like pretty much all ig downloader on github right now.

do you know any that can download the high res video via app api? Or do you have a python script for this? By the way I wish someone would write a full featured opensource instagram client, be it either a pure commandline tool or a small GUI - for now I only know of these very useful tools (and unfortunately they’re not all just python CLI tools but JavaScript/NPM‘s):

https://github.com/mathdroid/igdm-cli https://github.com/mathdroid/igdm-cli https://github.com/aranajhonny/ig-upload https://github.com/aranajhonny/ig-upload https://github.com/thelinuxchoice/igcomment https://github.com/thelinuxchoice/igcomment

dvingerh commented 5 years ago

do you know any that can download the high res video via app api? Or do you have a python script for this?

Afaik none publicly exist. You may use the script linked in https://github.com/notcammy/PyInstaStories/issues/14#issuecomment-491076127 but it's limited in functionality as mentioned in that comment. Feel free to modify it to your needs though

github-userx commented 5 years ago

Thanks. Unfortunately I have neither programming in general nor python skills.