【问题标题】:scraping all comments under an instagram post with python使用 python 抓取 Instagram 帖子下的所有评论
【发布时间】:2021-10-11 06:58:39
【问题描述】:

我从 youtube 获取代码:https://www.youtube.com/watch?v=0fNyKKeiv_0
代码开始了:

from selenium import webdriver
import time
import datetime
import insta_cred as cred

def get_comments():
    
    rettxt = []
    try:
        scroll = True
        count = 0
        while scroll and count < 15 : #scrolling

当我运行此代码“import insta_cred as cred”时,我的控制台出现错误:

ModuleNotFoundError: No module named 'insta_cred'

我该如何解决?

【问题讨论】:

    标签: python selenium comments instagram spyder


    【解决方案1】:

    您必须安装该软件包才能使用它。幸运的是,Python 通过 pip3 实用程序提供了这个功能。如果您知道要安装的软件包(某种形式的 instagram bot),您可以运行 pip3 install &lt;name of package&gt; 将其安装到您的机器上。

    【讨论】:

    • 是的,当我安装“pip3 install insta_cred”但没有“insta_cred”模块时
    • 快速谷歌搜索显示没有名为insta_cred的包;这是大学课程的一部分吗?如果您有权访问该包的代码,则需要在该目录中运行pip3 install .(注意.)。否则,在 Python 包索引中似乎有很多包用于此类事情,您可以使用这些包(尽管您必须阅读这些文档)
    • 我正在使用 . 但仍然无法正常工作 pip3 install .insta_cred 。这不是我的大学课程,但我想为自己学习。非常感谢你:)
    • 如果您无权访问insta_cred 的 Python 代码,它将无法工作。您必须拥有该代码,转到保存它的文件并运行pip3 install .。我认为这段代码来自 Uni 课程。相反,也许尝试使用本指南realpython.com/instagram-bot-python-instapy
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-20
    • 2018-08-16
    • 2022-01-16
    • 1970-01-01
    相关资源
    最近更新 更多