Python Forum
Beautiful soup won't find value even with CSS path copied.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beautiful soup won't find value even with CSS path copied.
#1
Hi everyone,

I'm very new to Python, my first project is writing a program to report a figure from a matched betting site, using ATBS as a guide so far. When selecting the info to parse, i get a blank response within the square brackets like so:

>>> soup.select('#tableBase > tbody > tr:nth-child(1) > td.rating.sorting_1')
[]
Any ideas why this is happening and how I can get that number selected?
here is the html from the table: https://pastebin.com/QXLPahsy

Thanks in advance!
Reply
#2
Could you supply the URL, much easier to examine the HTML from the actual site.
Reply
#3
getting to the specific url requires login unfortunately.
Reply
#4
My guess would be that you're getting the html from your browser's developer tools, and the tbody is not actually in the source, but inserted by the browser.
But it's only a guess, since we can't see the actual page.
Reply
#5
Its not sorting_1 but class="rating sorting\_1"
If i do test with your html.
from bs4 import BeautifulSoup

soup = BeautifulSoup(your_html, 'lxml')
td_sort = soup.find('td', class_="rating sorting\_1")
print(td_sort)
print(td_sort.text)
Output:
<td class="rating sorting\_1" style="color: rgb(0, 0, 0);">98.35</td> 98.35
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Beautiful Soup - access a rating value in a class KatMac 1 3,419 Apr-16-2021, 01:27 PM
Last Post: snippsat
  *Beginner* web scraping/Beautiful Soup help 7ken8 2 2,560 Jan-28-2021, 04:26 PM
Last Post: 7ken8
  Beautiful Soap can't find a specific section on the page Pavel_47 1 2,384 Jan-18-2021, 02:18 PM
Last Post: snippsat
  Help: Beautiful Soup - Parsing HTML table ironfelix717 2 2,622 Oct-01-2020, 02:19 PM
Last Post: snippsat
  Beautiful Soup (suddenly) doesn't get full webpage html j.crater 8 16,381 Jul-11-2020, 04:31 PM
Last Post: j.crater
  Requests-HTML vs Beautiful Soup - How to Choose? robin73 0 3,780 Jun-23-2020, 02:53 PM
Last Post: robin73
  looking for direction - scrappy, crawler, beautiful soup Sly_Corn 2 2,401 Mar-17-2020, 03:17 PM
Last Post: Sly_Corn
  Beautiful soup truncates results jonesjoz 4 3,793 Mar-09-2020, 06:04 PM
Last Post: jonesjoz
  Beautiful soup and tags starter_student 11 6,047 Jul-08-2019, 03:41 PM
Last Post: starter_student
  Beautiful Soup find_all() kirito85 2 3,311 Jun-14-2019, 02:17 AM
Last Post: kirito85

Forum Jump:

User Panel Messages

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