View Single Post
Old 08-29-2025, 01:00 PM   #7
Shohreh
Addict
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 211
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
Thanks for the tips. There's a site where I can sell boxes of books for free that I used before. I just need to make a list.

Looks like isbnsearch.org is pretty good.

Before I look further, if someone here knows Python and Beautifulsoup, how do I get the author and published date?

Code:
"""
<div class="bookinfo">
	<h1>My Title</h1>
	<p><strong>ISBN-13:</strong> <a href="/isbn/123">123</a></p>
	<p><strong>ISBN-10:</strong> <a href="/isbn/456">456</a></p>
	<p><strong>Author:</strong> My Author</p>
	<p><strong>Binding:</strong> Paperback</p>
	<p><strong>Publisher:</strong> My Publisher</p>
	<p><strong>Published:</strong> 2009</p>
	<p>
		<a class="special-link" href="https://bookscouter.com/book/123" target="_blank">Sell this book</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<a class="special-link" href="https://www.campusbooks.com/search/123?buysellrent=buy&popup" target="_blank">Buy or Rent?</a>
	</p>
</div>
"""

import requests
from bs4 import BeautifulSoup

HEADERS = ({'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36', 'Accept-Language': 'en-US, en;q=0.5'})

url = 'https://isbnsearch.org/isbn/123'

reqs = requests.get(url, headers=HEADERS)
soup = BeautifulSoup(reqs.text, 'lxml')
print("Title of the website is : ",soup.head.title.string)

div = soup.find("div", attrs={"class": 'bookinfo'})
print(div.h1.string)
for p in div("p"):
	#BAD print(p.string)
	print(p.text) #OK but I'd rather get the element's string
--
Edit: Not so good… After a while, isbn.org displays a "Please Verify to Continue". I'll go back to trying Amazon.

Code:
for div in soup("div", attrs={"class": 'puisg-col-inner'}):
	book_url = div.find("a", attrs={"class": 'a-link-normal s-line-clamp-2 s-link-style a-text-normal'})
	if book_url:
		print(book_url.string)

Last edited by Shohreh; 08-29-2025 at 01:36 PM.
Shohreh is offline   Reply With Quote