GitHub - luengwaiban/instagram-python-scraper: A instagram scraper wrote in pyth...
source link: https://github.com/luengwaiban/instagram-python-scraper
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
instagram-python-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! ☺️
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 require.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
Any star or help would be appreciated if it is helpful for you ~ ?♂️?
other
php library:https://github.com/postaddictme/instagram-php-scraper
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK