Reputation: 223
here is my predicament: What I wanna do is to get newly posts in a table named "theme".
this is what i have for new posts, new posts has a sticker:
new_posts = soup.select('tbody:has(.threadpages [src="images/new.gif"]), '
'tbody:has(.threadpages [src="images/new1.gif"]), '
'tbody:has(.threadpages [src="images/new2.gif"])')
this is what I have for the "theme" table:
theme_posts = soup.select('table:has(font:contains("theme")), '
is there a way I can combine both? I tried do table first, and then do new posts, it gives me Error saying
ResultSet object has no attribute '%s'. You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?" % key
can anyone help me out with it?
Upvotes: 1
Views: 124
Reputation: 223
I worked around yesterday, and I found a way, which is working pretty well. Here is the codes:
theme = soup.select('table:has(font:contains("there"))')
for item in theme:
for new in item.select('tbody:has(.threadpages [src="images/new.gif"]), '
'tbody:has(.threadpages [src="images/new1.gif"]), '
'tbody:has(.threadpages [src="images/new2.gif"])'):
and then whatever codes follow...
Upvotes: 1