Python中的文件proxies.json请求proxylist抛出错误

出现问题的软件:

github:

rarcega/instagram-scraper --proxies proxies.json

它引发的错误:

  

错误:检查有效的json类型。 json \ decoder.py“,第355行,在   raw_decode       从None提高JSONDecodeError(“期望值”,s,err.value)

我使用https://jsonformatter.curiousconcept.com/来验证我的proxies.json。它带有

  

警告:密钥重复,名称应唯一。[代码23,结构5]

根据instagram-scraper的文档:

  

-代理启用代理,添加带有http或/和https url的有效JSON。                       示例:'{“ http”:“ http://:”,“ http”:“ https://:”}'

我尝试使用--proxies {"http": "http://103.250.153.202:54028"} 在应用程序本身中,但会引发相同的错误 -- proxies proxies.json也不起作用。

proxies.json的内容:

{"http": "http://103.250.153.202:54028","http": "http://60.251.224.69:55977",etc,etc_last_entry}

好吧,我正在尝试获取有效的json格式,可悲的是,应用应用程序本身的预设根本不起作用。其他人似乎可以在github上运行它,所以我怀疑它是应用程序本身。

我对json不太熟悉,因此非常感谢您的帮助。

谢谢您的时间。

我通过编辑软件的app.py找到了解决方法 替换:

try:
    if self.proxies and type(self.proxies) == str:
        self.session.proxies = json.loads(self.proxies)
except ValueError:
    self.logger.error("Check is valid json type.")
    raise

   try:
        proxies = {
            "http": "http://181.143.157.242:50942","http": "http://119.82.253.63:34110"
        }
        if self.proxies: # and type(self.proxies) == str:
            #self.session.proxies = json.loads(self.proxies)
            self.session.proxies = proxies
    except ValueError:
        self.logger.error("Check is valid json type.")
        raise
jordandick 回答:Python中的文件proxies.json请求proxylist抛出错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3127181.html

大家都在问