jlobos / instagram-web-api

🤳 Instagram Private Web API client for Node
https://npmjs.com/instagram-web-api
MIT License
1.12k stars 185 forks source link

Cross origin errors #278

Open michaelpumo opened 2 years ago

michaelpumo commented 2 years ago

I'm not sure this is a problem with the library itself but requesting media found via the API, I get cross origin errors:

await client.login()

const photos = await client.getPhotosByUsername({
  username: 'mothanimation',
  first: 100,
})

const payload = photos.user.edge_owner_to_timeline_media

This gives me back a payload but images like: https://scontent-lcy1-2.cdninstagram.com/v/t51.2885-15/e15/s640x640/121419114_1251508065183762_3118685974291002946_n.jpg?_nc_ht=scontent-lcy1-2.cdninstagram.com&_nc_cat=106&_nc_ohc=X-g5qNrJVpAAX-QUNky&tn=l7oAA9r1W5sgJerz&edm=APU89FABAAAA&ccb=7-4&oh=e8008ba4fa711bd45eb15726e25ea726&oe=61B23A03&_nc_sid=86f79a

...are not able to be served from another website back to the user. Only viewing directly works (because its on their own domain).

Is this a known limitation? Is there any scope to work around this with the library?

Thanks

MonsieurBibo commented 2 years ago

Don't use this library. It is not maintained any more and might lead to a ban.

SupaMario123 commented 2 years ago

@MonsieurBibo can you recommend any other library?

MonsieurBibo commented 2 years ago

You can try instagram-private-api, it's more complex but way more complete.

michaelpumo commented 2 years ago

I actually end up using the Instagram Basic Display API through Facebook Developers area.

They don't make it easy or straight-forward to understand but I managed to get it up and running following this video: https://www.youtube.com/watch?v=cX8_YqqG6-Y

It works much faster than this library anyway, since you don't need to be logging into your account (which is slow). Hope this helps someone.