In this series, I have presented instascrape
's Profile
and Post
scrapers and discussed what data points they collect. For this post, we're going to look at what the Hashtag
scraper is able to scrape.
chris-greening / instascrape
Powerful and flexible Instagram scraping library for Python, providing easy-to-use and expressive tools for accessing data programmatically
instascrape: powerful Instagram data scraping toolkit
DISCLAIMER:
Instagram has gotten increasingly strict with scraping and using this library can result in getting flagged for botting AND POSSIBLE DISABLING OF YOUR INSTAGRAM ACCOUNT. This is a research project and I am not responsible for how you use it. Independently, the library is designed to be responsible and respectful and it is up to you to decide what you do with it. I don't claim any responsibility if your Instagram account is affected by how you use this library.
What is it?
instascrape is a lightweight Python package that provides an expressive and flexible API for scraping Instagram data. It is geared towards being a high-level building block on the data scientist's toolchain and can be seamlessly integrated and extended with industry standard tools for web scraping, data science, and analysis.
Key features
Here are a few of the things that…
The Hashtag
scraper scrapes 22 data points associated with an Instagram hashtag.
Instance attribute names have been chosen to be semantic and easy to understand.
The data points
The best way to learn is by example so we'll take a look at the #google hashtag's scraped Instagram data.
All instascrape
scrapers have a to_dict
method that returns all data as a dictionary so we can see everything in one shot.
from instascrape import Hashtag
google_hashtag = Hashtag('google')
google_hashtag.scrape()
google_hashtag.to_dict()
>>>
{'csrf_token': 'jfndsjklfhdasjklfhsdjklfasdhnfkjlsda',
'viewer': None,
'viewer_id': None,
'country_code': 'US',
'language_code': 'en',
'locale': 'en_US',
'device_id': '12345678-1234-1234-1234-123456789012',
'browser_push_pub_key': '1245643253543556555564',
'key_id': '87',
'public_key': 'alskdfnkl123213123ALSKDNfjklsdfasdfndsalfasdlfkh',
'version': '9',
'is_dev': False,
'rollout_hash': 'b10813bd9030',
'bundle_variant': 'es6',
'frontend_dev': 'c1f',
'id': '17843843635029645',
'name': 'google',
'allow_following': False,
'is_following': False,
'is_top_media_only': False,
'profile_pic_url': 'https://scontent-lga3-1.cdninstagram.com/v/t51.2885-15/e35/c0.79.639.639a/s150x150/133888980_3517051138410873_6063716563788721688_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com&_nc_cat=109&_nc_ohc=eteNTk5Tu3MAX98AX8f&tp=1&oh=c2e1906a7d31777531b1f5949c4ae81a&oe=60189A13',
'amount_of_posts': 9350019}
If you're interested in seeing instascrape
in action, check out some of my other posts that explore practical examples:
Scraping 10,000 data points from Donald Trump's Instagram page with Python
Chris Greening ・ Dec 20 '20 ・ 4 min read
Downloading recent Instagram photos using instascrape and Python
Chris Greening ・ Oct 26 '20 ・ 2 min read
In the next part of the series, we will be exploring what attributes are provided by the Location
scraper.
Top comments (1)
unable to execute the code... i dont know where the output is being stored am using jupyter notebook