03-01- css selectors (part 4 34:48 mins)

01

From the previous lesson, use fetch() and get the response

fetch('https://books.toscrape.com/')
response

02

 Inspect the page and find the element containing the books,
https://books.toscrape.com/ and use the shell to find the elemenet to place into the script

 The book is within an <article> element with a class product_pod, use the following css select to get all the books. Use . if class has any spaces

response.css('article.product_pod')

 This will return each book on the current page

03

Use the get() method to get the first instance of the books

response.css('article.product_pod').get()

04

Store the books in a variable

books = response.css('aricle:product_pod')
len(books)