我正在尝试使用python的insta scrape库,特别是获取instagram概要文件的所有帖子的方法
这是指向库页面的链接: https://pypi.org/project/insta-scrape/
这是指向图书馆文档的链接,特别是对于方法get_posts: https://instascrape.readthedocs.io/en/latest/instascrape.scrapers.html#module-instascrape.scrapers.profile
我的简单代码是:
options = Options()
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
insta_profile = Profile('https://www.instagram.com/molteni_matteo/')
insta_profile.scrape()
list_post = insta_profile.get_posts(webdriver=driver, amount=None,
login_first=False, login_pause=60,
max_failed_scroll=300, scrape=False, scrape_pause=5)
for profile_post in list_post:
print(profile_post)
但它给了我一个错误:
我怎样才能解决这个问题
这实际上是python模块中的一个bug,Profile不能正确地接受url。 您可以通过设置
insta_profile.url = 'https://www.instagram.com/molteni_matteo/'
在调用
get_posts
之前相关问题 更多 >
编程相关推荐