使用 python 的 Scrapy 代码给出一个网站的结果而不是另一个网站的结果

Scrapy code using python giving result for one website and not for another website

当我执行此代码时,我得到的结果格式为 {[text1,author1,tag1],[text2,author2,tag2],...}

import scrapy
class QuotesSpider(scrapy.Spider):
    name = "quotes"
    start_urls = [
        'http://quotes.toscrape.com/page/1/',
    ]

    def parse(self, response):
        for quote in response.css('div.quote'):
            yield {
                'text': quote.css('span.text::text').extract_first(),
                'author': quote.css('small.author::text').extract_first(),
                'tags': quote.css('div.tags a.tag::text').extract(),
            }

但是,在另一个 URL(下方)的相同代码中,我得到的结果是 {[name1,name2,..],[city1,city2,...] } 我想以 {[name1,city1],[name2,city2],...] 的形式使用它,因为它发生在上面的代码中。

import scrapy
class QuotesSpider(scrapy.Spider):
    name = "student"
    start_urls = [
        'http://www.engineering.careers360.com/colleges/list-of-engineering-colleges-in-karnataka?sort_filter=alpha',
    ]

    def parse(self, response):
        for students in response.css('div.list-pages'):
            yield {
                'name': students.css('div.title a::text').extract(),
                'city': students.css('div.clg-state a::text').extract(),                   
            }

您的学生选择器有问题:

for students in response.css('div.list-pages'):

这只会选择整个页面。
我想你在这里找的是:

for students in response.css('li.search-result'):