Python Forum
Find the next item once the previous one has been identified
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find the next item once the previous one has been identified
#1
Hello,

Here is the page I explore:
Advanced ASP.NET Core 3 Security

In particular I'm interested in the page's fragment "Product details":

[Image: Screenshot-from-2021-01-13-17-43-17.png]

Here is how I've found first items of "Product details" table (i.e. Publisher, Language, Paperback, etc.)
bbb = soup.find_all(attrs={"id":"detailBullets_feature_div"})
for child in list(bbb[1].children)[1].children:
  if isinstance(child, Tag):
     try:
       print("\n\1st item\t:", child.span.span.next_element.string)
     except:
       print("failed !")
How to find 2nd items in the table (i.e. Apress, English, 425 pages) ?
Thanks.
Reply
#2
Do you get anything at all,or do use Selenium(as may be needed here)?
Look at what info can get from Amazon Books API.
Quick test with Requests and BS.
Output:
<body> To discuss automated access to Amazon data please contact [email protected]. ..... <p class="a-last">Sorry, we just need to make sure you're not a robot. For best results, please make sure your browser is accepting cookies.</p>
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020