Instagram Profile Scraper avatar

Instagram Profile Scraper

Try for free

Pay $2.30 for 1,000 results

Go to Store
Instagram Profile Scraper

Instagram Profile Scraper

apify/instagram-profile-scraper
Try for free

Pay $2.30 for 1,000 results

Scrape all Instagram profile info. Just add one or more Instagram usernames and extract number of followers&follows, URLs, bio, posts, likes, counts, related profiles, captions, highlight reels. Export scraped data, run the scraper via API, schedule and monitor runs or integrate with other tools.

FB

How to scrape user ID instead of usernames?

Closed
fabshop opened this issue
19 days ago

I'm trying to scrape profiles using user ids, without success. It seems the input should be the same, because otherwise the actor complains, but the output is empty.

alexey avatar

If the correct profile ID is provided then profile details are scraped as expected: https://console.apify.com/view/runs/Je6ZcXnEM0CI2KY4q (787132 ID is "natgeo" profile)

If an incorrect profile ID is provided, it is saved as follows:

1{
2  "url": "https://www.instagram.com/1149037583270282",
3  "username": "1149037583270282",
4  "error": "not_found",
5  "errorDescription": "Post does not exist"
6}

So you can continue to scrape, actor works as expected. The error message will be changed later, now its not logically correct.

FB

fabshop

18 days ago

Oh, I'm using a wrong ID then. I got it from a webhook call from Instagram:

2025-02-02 10:32:56,103 - instagram_api - INFO - Received webhook: {'object': 'instagram', 'entry': [{'time': 1738503175641, 'id': '17841457912191756', 'messaging': [{'sender': {'id': '1149037583270282'}, 'recipient': {'id': '17841457912191756'}, 'timestamp': 1738503175056, 'message': {'mid': 'aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEOjE3ODQxNDU3OTEyMTkxNzU2OjM0MDI4MjM2Njg0MTcxMDMwMTI0NDI1OTc0MTIzOTQ0MTg1NjgwNjozMjA2OTcyMzE0MTYwMDUxOTg4NjU4MjEyMDI5MjgxMDc1MgZDZD', 'text': '6734'}}]}]}

According to the docs at https://developers.facebook.com/docs/messenger-platform/instagram/features/webhook/ the sender id field is:

"sender": { "id": "IGSID" }, // Instagram-scoped ID for the customer who sent the message

I thought that was the profile id, my mistake, thank you.

pd: the IG username can be obtained using the API https://graph.instagram.com/v22.0/{sender.id}

Developer
Maintained by Apify

Actor Metrics

  • 3.2k monthly users

  • 322 bookmarks

  • >99% runs succeeded

  • 22 hours response time

  • Created in Nov 2021

  • Modified 5 hours ago