How to get URL page title with scrapy in Python

1 Answer

0 votes
import scrapy

class Spider(scrapy.Spider):
    name = "SPIDER_NAME"

    start_urls = [
        'https://www.example.com/'
    ]

    def parse(self, response):
        yield {
            'title': response.css('title::text').get()
        }


# Windows 10
# Visual Studio Code - In TERMINAL

scrapy crawl SPIDER_NAME



''' 
run:

{'title': 'Example Domain'}

'''

 



answered Jun 17, 2020 by avibootz
edited Jun 18, 2020 by avibootz

Related questions

...