Python Forum
Beautiful Soap can't find a specific section on the page
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beautiful Soap can't find a specific section on the page
#1
Hello,

Here is my code to explore this page:
Artificial Intelligence to Solve Pervasive Internet of Things Issues

import requests
from bs4 import BeautifulSoup
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': 'bg,en-US;q=0.7,en;q=0.3',
    'X-Requested-With': 'XMLHttpRequest',
    'Connection': 'keep-alive'}

isbn =  9780128185766
book_web_page = f'http://www.amazon.com/s?k={isbn}&ref=nb_sb_noss'
response = requests.get(book_web_page, headers=headers)
print("status code:\t", response.status_code)
page = BeautifulSoup(response.text, 'html.parser')

link_section = page.find('span', attrs={'id', 'productTitle'})
print("link_section type:\t", type(link_section))
Here is output:
Output:
status code: 200 link_section type: <class 'NoneType'>
And yet this section is indeed there:

[Image: Screenshot-from-2021-01-18-12-34-10.png]

... and page is completely available, because return code is 200, which means Ok.
Any comments ?

Thanks
programerAnel likes this post
Reply


Messages In This Thread
Beautiful Soap can't find a specific section on the page - by Pavel_47 - Jan-18-2021, 11:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with searching over Beautiful Soap object Pavel_47 30 10,228 Jun-30-2022, 10:27 PM
Last Post: snippsat
  Beautifull Soap. Split page using a value and not a tag. lillo123 5 3,477 Apr-21-2021, 09:11 AM
Last Post: lillo123
  web scraping extract particular Div section AjayBachu 7 10,497 May-12-2020, 03:24 PM
Last Post: AjayBachu
  Web scraping read particular section AjayBachu 4 3,118 May-08-2020, 07:33 AM
Last Post: AjayBachu
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 3,670 Mar-19-2020, 06:13 PM
Last Post: apollo
  Beautiful soup and tags starter_student 11 6,288 Jul-08-2019, 03:41 PM
Last Post: starter_student
  Beautiful Soup find_all() kirito85 2 3,418 Jun-14-2019, 02:17 AM
Last Post: kirito85
  [split] How to find a specific word in a webpage and How to count it. marpop 2 5,850 Mar-12-2019, 08:25 AM
Last Post: snippsat
  Beautiful soup won't find value even with CSS path copied. AdequatelyChilled 4 4,123 Jan-01-2019, 12:12 PM
Last Post: snippsat
  Need help with Beautiful Soup - table jlkmb 9 6,021 Dec-20-2018, 01:10 AM
Last Post: jlkmb

Forum Jump:

User Panel Messages

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