[Instagram] Scrape Emails From Public Profiles

Meerakat

Elite Member
Joined
Sep 9, 2019
Messages
1,505
Reaction score
1,695
It is just a simple script that scrapes URL of each and every Instagram profile and tries to find out email from the user's biography in their profile feed. It hasn't hit any rate limits so far, at-least for now.

Requirements:

1. Basic NodeJS knowledge (you need to install some modules)

Code:

Code:
let fs = require('fs-extra'),
    ig = require('instagram-scraping');

let extractemail = function (text) {
    return text.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi);
}

let array = fs.readFileSync('./urls.txt', 'utf8').split('\n');
array = array.filter(function (str) {return /\S/.test(str)});

let wait = ms => new Promise((r, j) => setTimeout(r, ms)),
    arr = [];

const start = (async() => {
    for (i = 0; i < array.length; i++) {
        let result = await ig.scrapeUserPage(array[i])
        wait(2000)
        let email = extractemail(result.user.biography);
        arr.push(`${email}|${array[i]}`) //format is email:profile-link
    }
    const output = arr.join("\n");

    fs.writeFile("./emails.txt", output, function (err) {
        console.log("Scraped :)")
    });
})()

Make a .txt file called urls.txt and put all the profile urls there. Example: https://instagram.com/xxx (make sure there is a line gap between each link) and the script will find emails from their biography (if they have one). All the emails will be written in a file called "emails.txt".

Profile scraper coming soon :)
 
Thanks, man! How do I scape emails in business profiles which are mentioned in contact details with number? Can you tell me how to do this? Must be done by sock5 proxies. Can I get those for free from anywhere or is there an alternative? Ik I've asked too many questions but I really am finding a soln since days. I will be highly grateful.
 
Thanks, man! How do I scape emails in business profiles which are mentioned in contact details with number? Can you tell me how to do this? Must be done by sock5 proxies. Can I get those for free from anywhere or is there an alternative? Ik I've asked too many questions but I really am finding a soln since days. I will be highly grateful.

I will have a look my guy, if anybody here can tell me the process of how exactly it is done - I will definitely program one for FREE :)
 
I will have a look my guy, if anybody here can tell me the process of how exactly it is done - I will definitely program one for FREE :)
It's only possible with the mobile Api. Emails on business profiles aren't shown in the Web version of Instagram. After around 100 requests Instagram will block your Api requests and you have to wait a few minutes to send more. So to scrape at a decent speed you need to use multiple accounts in parallel.
 
It's only possible with the mobile Api. Emails on business profiles aren't shown in the Web version of Instagram. After around 100 requests Instagram will block your Api requests and you have to wait a few minutes to send more. So to scrape at a decent speed you need to use multiple accounts in parallel.

I do indeed have a private script which uses the mobile API, but I am unaware of the exact endpoint that returns an email or valuable information.
 
https://i.instagram.com/api/v1/users/{}/info/ . In the {} you need to insert the user id(pk)
In the returned json the email can be found under the key 'public_email'

The user needs to be a business account I believe? Actually, I do appreciate your input. It seems like you have worked with Instagram before, the email scraper is coming out soon :)
 
The user needs to be a business account I believe? Actually, I do appreciate your input. It seems like you have worked with Instagram before, the email scraper is coming out soon :)
If the user is no business or creator account the key 'public_email' will just not exist. So first you need to scrape a bunch of user ids and then you can loop through them and check if the email exists. With the same endpoint you can also scrape phone numbers. With the phone country code you can basically filter the countries for the scraped emails. But keep in mind that scrapping is relatively slow. With 10 accounts in parallel, you can expect around 1000 emails per hour.
 
I am following this thread closely as this is something I need.
 
The user needs to be a business account I believe? Actually, I do appreciate your input. It seems like you have worked with Instagram before, the email scraper is coming out soon :)

Please create this scraper man.
 
I remember seeing a list of all the end points but i can find it now, i am sure a simple google search will reveal it tho (i am on slow af 4g, my internet got disconnected until monday fml)

i really love the good spirit, but do consider that in order to be viable (might not be worth it to share it for free at that stage tho) -

it should be able to scrape by username and not by link, and to scrape the "hidden" email and phone, behind the mobile button.

How can i gather a bunch of relevant profile links? if i have the link i probably visited the profile, meaning manual work for each scraped email.

Or do you scrape the URLs too? (which is possible in scrapebox for example, with the right operators) but not sure about how this script would do it?

And i don't wanna sound like i'm shitting on your share, its just so you can better understand what is available already (not free from what i know)
 
I remember seeing a list of all the end points but i can find it now, i am sure a simple google search will reveal it tho (i am on slow af 4g, my internet got disconnected until monday fml)

i really love the good spirit, but do consider that in order to be viable (might not be worth it to share it for free at that stage tho) -

it should be able to scrape by username and not by link, and to scrape the "hidden" email and phone, behind the mobile button.

How can i gather a bunch of relevant profile links? if i have the link i probably visited the profile, meaning manual work for each scraped email.

Or do you scrape the URLs too? (which is possible in scrapebox for example, with the right operators) but not sure about how this script would do it?

And i don't wanna sound like i'm shitting on your share, its just so you can better understand what is available already (not free from what i know)

I actually have basic endpoints implemented script which does gather basic user information like followers count, if the account is whether a business account or not, etc...which means I will be able to scrape usernames through #hashtags => get their ID and use the endpoint for gathering their email + phone number.

But I do get your concern, giving it away for free might not be the best move or is it?
 
I actually have basic endpoints implemented script which does gather basic user information like followers count, if the account is whether a business account or not, etc...which means I will be able to scrape usernames through #hashtags => get their ID and use the endpoint for gathering their email + phone number.

But I do get your concern, giving it away for free might not be the best move or is it?

That's your call, i don't want to ruin the party.

when it will be fully functional if it will, its not something that i would share on the public sections, but that's just me, you as a developer might see it differently.
 
I actually have basic endpoints implemented script which does gather basic user information like followers count, if the account is whether a business account or not, etc...which means I will be able to scrape usernames through #hashtags => get their ID and use the endpoint for gathering their email + phone number.

But I do get your concern, giving it away for free might not be the best move or is it?

OP I would be interested if you share it with the community. Please consider this. Thanks.
 
Back
Top