The Instagram Profile scraper
Tags: python, showdev, datascience, contributorswanted
Published: 2020-12-26 16:35:08

In this blog post, we're going to take a quick peak at what data points are scraped from an Instagram profile page when using the `Profile` scraper provided by `instascrape`.

{% github chris-greening/instascrape %}

The `Profile` scraper scrapes 51 data points associated with an Instagram profile page. 

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 @google'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. 

```python
from instascrape import Profile 
google = Profile("google")
google.scrape()
google.to_dict()
>>>
{'csrf_token': 'HNSDJKGNFDJKGFDKJGNDFKSJ239048329084UJSKLDF',
 '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': 'BIBn3E_rWTci8Xn6P9Xj3btShT85Wdtne0LtwNUyRQ5XjFNkuTq9j4MPAVLvAFhXrUU1A9UxyxBA7YIOjqDIDHI',
 'key_id': '139',
 'public_key': 'a7db85ba1f0c3bdc5be6aeff1faadcbb8082bfb9f757990b90afd0e9f9619e7f',
 'version': '10',
 'is_dev': False,
 'rollout_hash': 'b10813bd9030',
 'bundle_variant': 'es6',
 'frontend_dev': 'prod',
 'logging_page_id': 'profilePage_1067259270',
 'show_suggested_profiles': False,
 'show_follow_dialog': False,
 'biography': 'Google unfiltered—sometimes with filters.',
 'blocked_by_viewer': False,
 'restricted_by_viewer': None,
 'country_block': False,
 'external_url': 'https://linkin.bio/google',
 'external_url_linkshimmed': 'https://l.instagram.com/?u=https%3A%2F%2Flinkin.bio%2Fgoogle&e=ATPiguryyJW2meNAk2LxG0-KfnYmPPQE4rdXSycwxdOiF9E_PjTnd56L4QqvftSldBYslIw1BcHJIhlF&s=1',
 'followers': 12364011,
 'followed_by_viewer': False,
 'following': 31,
 'follows_viewer': False,
 'full_name': 'Google',
 'has_ar_effects': False,
 'has_clips': True,
 'has_guides': True,
 'has_channel': False,
 'has_blocked_viewer': False,
 'highlight_reel_count': 6,
 'has_requested_viewer': False,
 'id': '1067259270',
 'is_business_account': True,
 'is_joined_recently': False,
 'business_category_name': 'Business & Utility Services',
 'overall_category_name': None,
 'category_enum': 'INTERNET_COMPANY',
 'is_private': False,
 'is_verified': True,
 'mutual_followers': 0,
 'profile_pic_url': 'https://scontent-lga3-1.cdninstagram.com/v/t51.2885-19/s150x150/126151620_3420222801423283_6498777152086077438_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com&_nc_ohc=lXdEi27jxecAX9hUsVW&tp=1&oh=da5dc7c6bb5f223255450522aa3ea3cf&oe=600FEC68',
 'profile_pic_url_hd': 'https://scontent-lga3-1.cdninstagram.com/v/t51.2885-19/s320x320/126151620_3420222801423283_6498777152086077438_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com&_nc_ohc=lXdEi27jxecAX9hUsVW&tp=1&oh=21880564a3688c7650948b63aca5c895&oe=6011C871',
 'requested_by_viewer': False,
 'username': 'google',
 'connected_fb_page': None,
 'posts': 1457}
```

And there we have it! If you're interested in seeing `instascrape` in action, check out some of my other posts that explore practical examples:

{% link https://dev.to/chrisgreening/scraping-10-000-data-points-from-donald-trump-s-instagram-page-with-python-2jcg %}
{% link https://dev.to/chrisgreening/downloading-an-instagram-profile-s-recent-photos-using-python-25b2 %}