Instagram Reels Views Analysis

Job ID: 38605356

Budget: €30 – €250 EUR

General Description

This project aims to automate the scraping of video statistics from Instagram accounts, specifically reels.
The process involves obtaining data from a list of users and applying a filter based on the average views of their recent videos, identifying those that meet certain popularity criteria. The resulting information will be stored in Airtable for further analysis and management.

Script Configuration

The script is designed in Python and is fully configurable through a config.json file. This file allows you to adjust the following key parameters:

- max_videos: Defines the maximum number of videos to scrape per account. If the account doesn't have enough videos,
it will scrape the maximum available.

max_videos = 80 // Maximum number of videos to scrape

- max_average: Specifies the number of recent videos to consider when calculating the average views.

max_average = 10 // Number of recent videos to calculate the average

- multiplier_average: This value is used to multiply the obtained average views, defining a threshold that videos
must meet to be considered "popular".

multiplier_average = 3 // Multiplication factor to determine the view threshold

- min_views: Specifies the minimum number of views a video must have to be considered for further analysis.

min_views = 1000 // Minimum number of views required for a video to pass the filter

- multiplier_one_star: Defines the multiplier for a video to receive 1 star.

multiplier_one_star = 1 // Threshold for 1 star rating

- multiplier_two_stars: Defines the multiplier for a video to receive 2 stars.

multiplier_two_stars = 1.5 // Threshold for 2 star rating

- multiplier_three_stars: Defines the multiplier for a video to receive 3 stars.

multiplier_three_stars = 2 // Threshold for 3 star rating

Technical Process

1. Airtable Connection:
The bot will be linked to an Airtable table that stores the Instagram usernames to be analyzed in one column.
The script will access this table to get the list of profiles to check.

2. Login to Instagram:
The bot will need to be authenticated on Instagram using cookies previously saved in a cookies.json file.
This is necessary since Instagram does not allow access to view statistics without being logged in.

3. Video Scraping:
For each user listed in Airtable:
- The bot will access the user's reel profile URL: https://www.instagram.com/username/reels/.
- It will retrieve up to max_videos and capture the ID of each video along with the number of views.
If the account has fewer videos, it will retrieve all available ones.
- If the account doesn't exist or is banned, it will be marked as invalid in Airtable, and the bot will move on to the next user.

4. Average View Calculation and Filtering:
The script will calculate the average views based on the last max_average videos. Once the average is calculated, it will be multiplied by
the multiplier_average to set the threshold of views that videos need to meet. Additionally, each video must have at least min_views to qualify.
Only videos that satisfy both conditions (the threshold set by the multiplier and the min_views) will be considered.

5. Storing in Airtable and Updating Existing Videos:
Videos that meet these conditions will be added to a second Airtable table, storing "popular" videos that meet the view criteria. If the video already exists in Airtable,
the bot will check if the video’s star classification has changed. If the classification has changed, it will update the following fields:
- views: The updated number of views.
- multiplier_real: The updated multiplier of the video compared to the average.
- classification: The updated star rating (based on multiplier_one_star, multiplier_two_stars, and multiplier_three_stars).
- Updated: The current date will be added to indicate when the classification was last modified. Changes in views alone will not trigger an update of the Updated field.

Data to be Stored in Airtable

In the second Airtable table (where popular videos are stored), the following information will be included:

- video-id: The unique identifier of the video on Instagram.
- username: The Instagram account username that posted the video.
- views: The total number of views of the video.
- link: The full video link, which is constructed as follows:

https://www.instagram.com/reel/{video-id}/

- multiplier_real: The actual multiplier of the video views compared to the average of the recent videos.

- classification: The star rating (1 to 3 stars) based on the actual multiplier of the video. The classification is determined as follows:
- 1 star: If the multiplier_real is less than or equal to multiplier_one_star.
- 2 stars: If the multiplier_real is greater than multiplier_one_star but less than or equal to multiplier_two_stars.
- 3 stars: If the multiplier_real is greater than multiplier_two_stars but less than or equal to multiplier_three_stars.

- Updated: The date when the video was last modified in Airtable, only updated when the classification changes.
Related categories: Python Web Scraping Data Mining Instagram Airtable