how to scrape likes on instagram

  • Last Update :
  • Techknowledgy :

To extract that kind of information, you'll need to use our Instagram Scraper. The scraper is free to use and will let you download all of this public data from Instagram:,Our Instagram Scraper is one of many actors available in Apify Store. Apify actors are cloud programs that accept input, perform their job, and generate some output. They can be run manually in the app, using the API or scheduler.,Now you can use our ultra-fast and easy dedicated scrapers if you want to scrape specific Instagram data. These Instagram scrapers have fewer settings to change and they'll give you fast, clean results ⬇️,Although it would be possible to automatically log in to Instagram in order to access this data, this approach is risky since it can lead to the banning of your account by Instagram. Sure, you could create a fake Instagram account and use that instead, but that’s beyond the scope of this article.

There is even a nice internal API endpoint that can be used to get the results in JSON format:

https: //www.instagram.com/web/search/topsearch/?context=blended&query=avengers

Suggestion : 2

Given the hypothesis that you already collected some posts url, you could easily get the likes by doing the following:

posts = ['BxuiTcLnTWO', 'BxkKDnCngp0', 'BxiNq5-nxOj', 'Bxhr01unQ11']

for post in posts:
   post_url = 'https://www.instagram.com/p/{}/'.format(post)
response = requests.get(post_url.format(post))
soup = BeautifulSoup(response.content)
sharedData = soup.find('script', text = re.compile('"mainEntityofPage"')).text
likes = json.loads(sharedData.strip())['interactionStatistic']['userInteractionCount']
print(post_url, '-', likes, 'likes')

pip install using pip install insta-scrape and then

from instascrape
import Post
google_post = Post("https://www.instagram.com/p/CG0UU3ylXnv/")
google_post.load()
print(f "{google_post.likes} likes") >>>
   "37210 likes"

Suggestion : 3

Instagram scraping means automatically gathering publicly available data from Instagram users. The process may include scraping tools, Instagram scraping services or manually extracting the data. You can scrape data like as email addresses, phone numbers, images, bio, likes, comments, etc. ,While Instagram forbids any kind of crawling, scraping, or caching content from Instagram it is not regulated by law. Meaning, if you scrape data from Instagram you may get your account banned, but there are no legal repercussions.,To scrape Instagram with Python you can use a tool like Instagramy. This tool is specifically created for Instagram and has data analyzing ability through Pandas. ,You can use Python (GitHub) to build your own Instagram scraper or buy Instagram users' data from Influencers Club.

pip install instagramy
from instagramy
import Instagram

# Connecting the profile
user = Instagram("geeks_for_geeks")

# printing the basic details like
# followers, following, bio
print(user.is_verified())
print(user.popularity())
print(user.get_biography())

#
return list of dicts
posts = user.get_posts_details()

print('\n\nLikes', 'Comments')
for post in posts:
   likes = post["likes"]
comments = post["comment"]
print(likes, comments)
from instagramy
import Instalysis

# Instagram user_id of ipl teams
teams = ["chennaiipl", "mumbaiindians",
   "royalchallengersbangalore", "kkriders",
   "delhicapitals", "sunrisershyd",
   "kxipofficial"
]

data = Instalysis(teams)

#
return the dataframe
data_frame = data.analyis()
data_frame
def get_likes_list(username):
   api.login()
api.searchUsername(username)
result = api.LastJson
username_id = result['user']['pk'] # Get user ID
user_posts = api.getUserFeed(username_id) # Get user feed
result = api.LastJson
media_id = result['items'][0]['id'] # Get most recent post
api.getMediaLikers(media_id) # Get users who liked
users = api.LastJson['users']
for user in users: # Push users to list
users_list.append({
   'pk': user['pk'],
   'username': user['username']
})

Suggestion : 4

Two Factor Authentication is also supported through cli interface, simply use 'True' for second argument of login() function,It is not easy to get Applications approved for Instagram's API therefore I created this tool inspired by instagram-php-scraper. The goal of this project is to become as minimalistic as possible while still having all the needed functionality so that its easy to add code to it!,If different proxies and accounts are used for all requests and the circle doesn't repeat too fast these limits don't apply ;),If you use authentication, the program will cache the user session by default so one doesn't need to create session every time. If one want to disable the user session cache, assign True to Instagram.login() method

pip install igramscraper
pip install - r requirements.txt
from igramscraper.instagram
import Instagram

instagram = Instagram()

# authentication supported
instagram.with_credentials('username', 'password')
instagram.login()

#Getting an account by id
account = instagram.get_account_by_id(3)

# Available fields
print('Account info:')
print('Id: ', account.identifier)
print('Username: ', account.username)
print('Full name: ', account.full_name)
print('Biography: ', account.biography)
print('Profile pic url: ', account.get_profile_picture_url())
print('External Url: ', account.external_url)
print('Number of published posts: ', account.media_count)
print('Number of followers: ', account.followed_by_count)
print('Number of follows: ', account.follows_count)
print('Is private: ', account.is_private)
print('Is verified: ', account.is_verified)

# or simply
for printing use
print(account)
from igramscraper.instagram
import Instagram

proxies = {
   'http': 'http://123.45.67.8:1087',
   'https': 'http://123.45.67.8:1087',
}

instagram = Instagram()
instagram.set_proxies(proxies)

account = instagram.get_account('kevin')
print(account.identifier)

Suggestion : 5

Last Updated : 17 May, 2022

The python package Instagramy is used to scrape Instagram quick and easily. This package is installed by running the following command. Based on the network connection it scrapes the data for you.

pip install instagramy