json.decoder.JSONDecodeError: While Parsing data form an API contains Japanese Characters

json.decoder.JSONDecodeError: While Parsing data form an API contains Japanese Characters

我试图用 ScrapyJSON 解析 API 响应,但它给我生成了一个错误 json.decoder.JSONDecodeError:

我尝试了 here 中的所有日文 encoding 类型,但 none 有效。希望大佬们给个解决办法。

下面是我的代码:

import scrapy
import json

class MakuakeSpider(scrapy.Spider):
    name = 'makuake'
    start_urls = ['https://api.makuake.com/v2/projects?page=1&per_page=15&category_code=technology']

    def parse(self, response):
        json_rsp = json.loads(response.body).encode("encoding-type-jps").decode("utf-8")
        print(json_rsp)

试试这个response.text

import scrapy
import json

class MakuakeSpider(scrapy.Spider):
    name = 'makuake'
    start_urls = ['https://api.makuake.com/v2/projects?page=1&per_page=15&category_code=technology']

    def parse(self, response):
        json_rsp = json.loads(response.text)
        print(json_rsp)