Я новичок в парсинге веб-страниц. Я пытаюсь извлечь список URL-адресов с веб-страницы, но href содержит каталог вместо URL-адреса. Есть ли способ получить вместо этого URL-адреса?
Мой код:
url='https://www.goodreads.com/shelf/show/bestsellers'
elements = requests.get(url).text
soup = BeautifulSoup(elements, "html.parser")
for link in soup.findAll('a',attrs={'class':"leftAlignedImage"}):
print (link['href'])
Вывод:
/book/show/5060378-the-girl-who-played-with-fire
/book/show/968.The_Da_Vinci_Code
/book/show/4667024-the-help
/book/show/2429135.The_Girl_with_the_Dragon_Tattoo
...