Now, the question here is, do you need to make yet another request to get the book title. And the answer is - NO
import requests from bs4 import BeautifulSoup isbn = 9783319988412 url = f'http://www.amazon.com/s?k={isbn}&ref=nb_sb_noss' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0', 'Accept': 'text/html,*/*', 'Accept-Language': 'en,en-US;q=0.7,en;q=0.3', 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'keep-alive'} resp = requests.get(url, headers=headers) soup = BeautifulSoup(resp.text, 'lxml') # using find a = soup.find('a', {'class': 'a-link-normal a-text-normal'}) print(a.get('href')) print(a.text.strip())
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs