【问题标题】:scrape data from Instagram - errors while running Instascrape从 Instagram 抓取数据 - 运行 Instascrape 时出错
【发布时间】:2022-12-12 15:43:16
【问题描述】:

我正在尝试使用 instascrape 抓取帖子以及与该帖子相关的其他信息。我收到一个错误。所以请帮我解决这个问题。如果您知道任何其他可以执行相同操作的软件包,请告诉我。

from selenium.webdriver import Chrome 
from instascrape import Profile, scrape_posts
webdriver = Chrome("path/to/chromedriver.exe")

headers = {
    "user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.57",
    "cookie": "sessionid=PASTE_YOUR_SESSIONID_HERE;"
}
joe = Profile("joebiden")
joe.scrape(headers=headers)

输出:

JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

【问题讨论】:

    标签: python scrape


    【解决方案1】:

    当我们尝试解析无效的 JSON 字符串(例如,单引号键或值,或尾随逗号)时,会出现 Python“JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)”。使用ast.literal_eval()方法解决错误。

    这是一种解决方法

    【讨论】:

      猜你喜欢
      • 2016-10-25
      • 1970-01-01
      • 1970-01-01
      • 2018-02-04
      • 2018-01-11
      • 1970-01-01
      • 2022-11-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多