Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support getting additional photo sizes #7

Open
raiym opened this issue Feb 12, 2016 · 4 comments
Open

Support getting additional photo sizes #7

raiym opened this issue Feb 12, 2016 · 4 comments

Comments

@raiym
Copy link

raiym commented Feb 12, 2016

Scraper gives only 640x640 photo urls even if photo exists in 1080x1080

@notslang
Copy link
Owner

Yeah, over in posts.coffee:70, we just pick the standard resolution. However, looking at an example of the response, it seems like you can derive the other URLs from the standard resolution URL:

{
  "images": {
    "low_resolution": {
    "url": "https://scontent-ord1-1.cdninstagram.com/t51.2885-15/s320x320/e35/12531128_1720535754825405_615608517_n.jpg?ig_cache_key=MTE4MzA1OTUyNjk1ODY0ODUwMQ%3D%3D.2",
    "width": ​320,
    "height": ​320
    },
    "thumbnail": {
      "url": "https://scontent-ord1-1.cdninstagram.com/t51.2885-15/s150x150/e35/12531128_1720535754825405_615608517_n.jpg?ig_cache_key=MTE4MzA1OTUyNjk1ODY0ODUwMQ%3D%3D.2",
      "width": ​150,
      "height": ​150
    },
    "standard_resolution": {
      "url": "https://scontent-ord1-1.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/12531128_1720535754825405_615608517_n.jpg?ig_cache_key=MTE4MzA1OTUyNjk1ODY0ODUwMQ%3D%3D.2",
      "width": ​640,
      "height": ​640
    }
  }
}

I would much rather give some single standard URL for the resource, or a simple media ID with a function for formatting that ID into a URL for whatever representation of the image you want, and I'd gladly take a PR for that.

@raiym
Copy link
Author

raiym commented Feb 12, 2016

JSON.stringify(rawPost.images.low_resolution.url).replace('320x320', '1080x1080')

This worked pretty well for me. Somehow instagram stores photos in these urls even if there is no 1080px image

@raiym
Copy link
Author

raiym commented Apr 14, 2016

I created service backupitfor.me on top of your library.
Any plans to add 1080x1080 support natively?

@notslang notslang changed the title Scraper gives only 640x640 photo urls even if photo exists in 1080x1080 Support getting additional photo sizes Apr 14, 2016
@fabiocaccamo
Copy link

I just founded and tested this scraper and it works very well. The only problem is that the image returned is not at the highest resolution.

Actually the highest resolution image url can be founded in meta property og:image, check it here: https://github.com/soimort/you-get/blob/develop/src/you_get/extractors/instagram.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants