luengwaiban/instagram-python-scraper
A instagram scraper wrote in python. Similar to instagram-php-scraper.Usages are in example.py. Enjoy it!
repo name | luengwaiban/instagram-python-scraper |
repo link | https://github.com/luengwaiban/instagram-python-scraper |
homepage | |
language | Python |
size (curr.) | 86 kB |
stars (curr.) | 114 |
created | 2019-06-02 |
license | MIT License |
instagram-python-scraper
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 ~ πββοΈπ
install
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
usages
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)
more usages
See more usages
once again:
Any star or contribution would be appreciated if it is helpful for you ~ πββοΈπ
other
php library:https://github.com/postaddictme/instagram-php-scraper