this repo is now merging with realsirjoe/instagram-scraper
, get latest version at 👉 instagram-scraper 👈
A instagram scraper wrote in python.Get medias, account, videos, comments without authentication.Comment and like action also supported.
Similar to instagram-php-scraper. Enjoy it!
**Any star or contribution would be appreciated if it is helpful for you ~** 🙋♂️🌚
You can simply run this command:
pip install instagram-python-scraper
Or you can also download it directly and install the libs that recorded in require.txt first.
Run the command below:
pip install -r requirements.txt
Some methods require authentication:
from instagram_scraper.instagram import InstagramScraper
instagram = InstagramScraper()
# authentication supported
instagram.with_credentials('your account', 'your password')
res = instagram.login()
followers = instagram.get_followers('206034174', 20, 20, True)
print(followers[0])
If you use authentication the program will cache the user session by default so that you don't need to gain session everytime.
But if you want to disable the user session cache, just assign True
to login() method:
from instagram_scraper.instagram import InstagramScraper
instagram = InstagramScraper()
instagram.with_credentials('your account', 'your password')
res = instagram.login(True)
Besides, account verification is also supported by default. When a account verification is needed, you will receive a active code by email or something and you should then input the code in terminal to finish verification.
Many of the methods do not require authentication:
from instagram_scraper.instagram import InstagramScraper
instagram = InstagramScraper()
account = instagram.get_account('shaq')
account_id = account.get_id()
print(account._id)
Using proxy for requests:
from instagram_scraper.instagram import InstagramScraper
proxies = {
'http': 'http://127.0.0.1:1087',
'https': 'http://127.0.0.1:1087',
}
instagram = InstagramScraper()
instagram.set_proxies(proxies)
account = instagram.get_account('shaq')
account_id = account.get_id()
print(account._id)
See more usages
once again:
**Any star or contribution would be appreciated if it is helpful for you ~** 🙋♂️🌚
php library:https://github.com/postaddictme/instagram-php-scraper