Scrape followers from Instagram accounts
FollowIn this tutorial, we will show how to scrape the followers' information of a public Instagram account.
Take this URL for example: https://www.instagram.com/rihannaofficilal/
You may also download the otd file in this tutorial and import it to Octoparse for reference.
Here are the steps in this tutorial:
1. Create a Go to Web Page - to open the target web page
2. Log in to your account - to save cookies for authentication
3. Extract Data - to extract basic information of the Instagram account
4. Click on Followers - to collect the follower information
5. Modify the Loop Item and data fields XPath - to get the data is scraped precisely
6. Add scroll page workflow - Scroll down to get more followers
7. Run your task - to get the data you want
Let's start!
1. Create a Go to Web Page - to open the target web page
- Input the Instagram link and click Start to create a new task
2. Log in to your account - to save cookies for authentication
- Turn on Browse Mode
- Enter your username and password in the textbox
- Click Log in
- Tick Use cookies under the Go to Web Page, Click Use cookie from the current page, then click Save
- Turn off Browse Mode
3. Extract Data - to extract basic information of the Instagram account
- Click on the account name, number of followers, number of following etc,
- Click on Extract data from the Tips
4. Click on Followers - to collect the follower information
- Click the Followers button
- Click element in the Tips panel
- Set the ajax timeout as 7s
- Untick Open in a new tab of Click Item settings
You will see a pop up with a list of followers shown on the page.
- Click on the first username
- Click Select All, then click Extract the text of the selected elements
Extracting the followers' URL may be a little tricky
- Click on the title
- Click the A tag in the Tips panel
- Click Extract the URL of the selected link
- Double-click the headers to rename them in the Data preview section
5. Modify the Loop Item and data fields XPath - to get the data is scraped precisely
- Click on Loop Item
- Modify the XPath to //div[@class="isgrP"]//li
- Click Apply to save
- Click on Extract Data
- Click Vertical View
- Modify the XPath of the Username to //a/span
- Modify the XPath of the Username_URL to //a
6. Add scroll page workflow - Scroll down to get more followers
- Click the add a step button
before the Loop Item and Click Loop
- Move the Loop Item to the newly created Loop Item1
- Change Loop Mode of Loop Item1 to Scroll Page
- Select Partial in the Scroll area, enter the Xpath as: //div[@class="isgrP"]
- Set the repeat time (e.g. 30), add the wait time longer (e.g. 5s)
- Click Apply
- Move the Loop Item inside the Loop Item1
7. Run your task - to get the data you want
The final workflow is like this:
- Click Save, and click Run on the upper right side
- Select Run on your device to run the task on your computer
Author: Kisad
Editor: Yina