抓取媒体、喜好、关注者、标签和所有元数据
igramscraper的Python项目详细描述
Instagram_刮刀
这是一个用python编写的极简instagram scraper。它可以获取媒体、帐户、视频、评论等。 `还支持“comment”和“like”操作。
要获得Instagram API的应用程序批准并不容易,因此我在instagram-php-scraper的启发下创建了这个工具。
这个项目的目标是成为尽可能简约,同时仍然有所有需要的功能,以便它很容易添加代码到它!
如果您喜欢这个项目,任何或贡献都将不胜感激
如何安装
只需运行:
pip install igramscraper
或者通过git clone下载项目并运行以下命令:
pip install -r requirements.txt
用法
某些方法确实需要验证:
fromigramscraper.instagramimportInstagraminstagram=Instagram()# authentication supportedinstagram.with_credentials('username','password')instagram.login()#Getting an account by idaccount=instagram.get_account_by_id(3)# Available fieldsprint('Account info:')print('Id: ',account.identifier)print('Username: ',account.username)print('Full name: ',account.full_name)print('Biography: ',account.biography)print('Profile pic url: ',account.get_profile_pic_url_hd())print('External Url: ',account.external_url)print('Number of published posts: ',account.media_count)print('Number of followers: ',account.followed_by_count)print('Number of follows: ',account.follows_count)print('Is private: ',account.is_private)print('Is verified: ',account.is_verified)# or simply for printing use print(account)
如果使用身份验证,程序将在默认情况下缓存用户会话,因此不需要每次都创建会话。
如果要禁用用户会话缓存,请将True
分配给instagram.login()方法
通过cli接口还支持双因素身份验证,只需对login()函数的第二个参数使用'true'。
许多方法不需要身份验证
有关详细信息,请浏览示例文件夹
对请求使用代理:
fromigramscraper.instagramimportInstagramproxies={'http':'http://123.45.67.8:1087','https':'http://123.45.67.8:1087',}instagram=Instagram()instagram.set_proxies(proxies)account=instagram.get_account('kevin')print(account.identifier)
更多用法
参见示例here。
如何贡献
欢迎您的任何贡献,查看我们的TODOs
加入我们的电报组:https://t.me/joinchat/J86yTBAtZlEi-6T6LOxijw
其他
instagram php刮刀here