Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Web-Scraping/aravindha1234u/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Instagram Scraper with GraphQL Endpoint

This is python simple script to scrape maximum public infomation of account with username and it does not have any dependency other than inbuilt python modules.

## How to Use:

`Python3 Scraper.py <username>`
32 changes: 32 additions & 0 deletions Web-Scraping/aravindha1234u/Scraper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import requests
import sys

def Instagram(username):
r = requests.get("https://www.instagram.com/"+ username +"/?__a=1")
if r.status_code == 200:
res = r.json()['graphql']['user']
print("\nUsername: " + res['username'])
print("Full Name: "+res['full_name'])
print("Biograph: " + res['biography'])
print("URL: "+ str(res['external_url']))
print("Followers: "+str(res['edge_followed_by']['count']))
print("Following: "+str(res['edge_follow']['count']))
print("has_channel: "+str(res['has_channel']))
print("Business Account: "+str(res["is_business_account"]))
if res['is_business_account']:
print("Business Category: "+str(res['business_category_name']))
print("category_enum: "+str(res['category_enum']))
print("Joined Recently: "+str(res['is_joined_recently']))
print("Private Account: "+str(res['is_private']))
print("Verified: "+str(res['is_verified']))
print("Facebook Account: "+str(res['connected_fb_page']))
print("Profile Picture HD: " + res['profile_pic_url_hd'])
elif r.status_code == 404:
print("Error: Profile Not Found")
else:
print("Error: Something Went Wrong")

if len(sys.argv) == 1 or sys.argv[1] =="-h":
print("Usage: python3 Scraper.py <username>")
else:
Instagram(sys.argv[1])