Is the data in the JSON file crawled by Scrapy empty?

problem description

this is my first contact with the Scrapy framework. When crawling the data in the JSON file in Scrapy, using print detection found to be empty, do not know what is going on, please give advice!

the environmental background of the problems and what methods you have tried

The environment for

Python is Python 3.7. Try to say response.text () online is invalid.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
import scrapy
import json
from scrapy.http import Request
from urllib import parse

from MovieSpider.MovieSpider.items import MoviespiderItem
class MovieSpider (scrapy.Spider):

name = "MovieSpider"
allowed_domains = ["movie.douban.com"]
start_urls = ["https://movie.douban.com/j/search_subjects?type=movie&tag=%E5%86%B7%E9%97%A8%E4%BD%B3%E7%89%87&sort=rank&page_limit=20&page_start=0"]

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

what result do you expect? What is the error message actually seen?

No error is reported, but the output is empty. Please give me your advice.

Apr.05,2021

the code you posted is incomplete, isn't it? Your code doesn't work.
try this to get json data

import requests
url = 'https://movie.douban.com/j/search_subjects?type=movie&tag=%E5%86%B7%E9%97%A8%E4%BD%B3%E7%89%87&sort=rank&page_limit=20&page_start=0'
request = requests.get(url)
json_list = request.json()

to learn to do a test with scrapy shell https://movie.douban.com/.
, I estimate that nine times out of ten your HTTP request header is written incorrectly, to see if the returned code is 403?


try:
DEBUG: Crawled (403) < GET https://movie.douban.com/j/se.; Tag=%E5%86%B7%E9%97%A8%E4%BD%B3%E7%89%87&sort=rank&page_limit=20&page_start=0 > (referer: None)

so you need to add User-Agent, to setting and change ROBOTSTXT_OBEY to False

.

yield item is missing. Or return item is missing one.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb3d18-48249.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb3d18-48249.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?