Question: #Using the following link: ( the link for the best selling books on the New York Times ) # 1 . Where are the titles
#Using the following link:
the link for the best selling books on the New York Times
# Where are the titles stored? Copy and paste the HTML Element that contains all the titles
# What type of HTML Element does contians the titles
#write a script that pulls all of the following information
# Title
# Author
# Publisher
# Description
# How Long on the list
# Use the above script to write a loop that stores the above informaiton
# for each week URL will change from above to
the url for the best selling books in the New York TimesbooksbestsellersYEARMONTHDAYcombinedprintandebooknonfiction
#where YEAR, MONTH, AND DAY will need to be input through a script
#it is important to note that the NYT only publishes weekly
#so you will need to have a something that tests if you are getting results back
#
# PICK RANDOM DATES THAT ARE NOT THE ONES BELOW
# MAKE SURE IT IS ONE YEAR
#
#with the above information I would like you to add:
# Date you entered in you URL
# Week number
from datetime import datetime as dt
from datetime import timedelta
import requests
from bs import BeautifulSoup as soup
import pandas as pd # type: ignore
def daterangestartend,step:
start dtstrptimestartYmd
end dtstrptimeendYmd
while start end:
yield start
start timedeltastep
for x in daterange:
url fthe link to the pagebooksbestsellersxyearxmonthxdaycombinedprintandebooknonfiction
#r requests.geturl
#printrstatuscode #check if this is pass else write your scrapecode
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
