quote = response.css("div.quote")[0]
text = quote.css("span.text::text").get()
author = quote.css("small.author::text").get()
tags = quote.css("div.tags a.tag::text").getall()
To extract the quotes from the webpage, observe how they are represented in HTML on the webpage:
<div class="quote">
<span class="text">“Quote here”</span>
<span>
by <small class="author">Author Name</small>
<a href="/author/Author-Name">(about)</a>
</span>
<div class="tags">
Tags:
<a class="tag" href="/tag/tag-name/page/1/">tag-name</a>
</div>
</div>
Using the Scrapy shell, you can extract the text, author, and tags:
quote = response.css("div.quote")[0]
text = quote.css("span.text::text").get()
author = quote.css("small.author::text").get()
tags = quote.css("div.tags a.tag::text").getall()
Use the Search Bar to find content on MarketingMind.
Contact | Privacy Statement | Disclaimer: Opinions and views expressed on www.ashokcharan.com are the author’s personal views, and do not represent the official views of the National University of Singapore (NUS) or the NUS Business School | © Copyright 2013-2025 www.ashokcharan.com. All Rights Reserved.