Created
April 4, 2019 13:36
-
-
Save KartSriv/c27962e0431b90d641a39f87039befcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
# Modules | |
import urllib # Opening URLs | |
from urllib.request import urlopen # urlopen() Function | |
from bs4 import BeautifulSoup # For Scraping | |
import sys # For Arguments | |
username = str(sys.argv[1]) | |
URL = "https://www.instagram.com/"+username+"/" | |
def initilizeScraper(URL): | |
Webpage = urllib.request.urlopen(URL) | |
Scraper = BeautifulSoup(Webpage.read(), "html.parser") | |
return Scraper | |
def fetchData(Scraper,tag,classOfData,removeStart,removeEnd): | |
Data = Scraper.find(tag, class_=classOfData) | |
Data = str(Data) | |
Data = Data.replace(removeStart, '') | |
Data = Data.replace(removeEnd , '') | |
return Data | |
Scraper = initilizeScraper(URL) | |
Followers = fetchData(Scraper,"span","g47SY","<span class=\"g47SY \" title=\"382\">","</span>") | |
print(Followers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment