Quote:
Originally Posted by Starson17
Here is what I gave you last time. Why doesn't that work?
In line 1 it finds all the <h2> tags.
In line 2 it looks at each one to decide if there is an <a> tag inside.
In line 3, if there was an <a> tag found, it proceeds to do what needs to be done (look at the code I gave you again).
I looked at the http://www.laineygossip.com/ page and it seems to have the same structure, with <a> tags (having the link you want) inside <h2> tags.
|
i think your missing what I was trying to ask or I asked it wrong. Yes your code works fine even on this page yet there is an exception which is what I'm having an issue with. The part that you mentioned with the for item in soup.findAll('h2') works great and I actually got that working fine. What my issue is is the first part of that where some of the articles are not within that structure. I will continue to work at it and see what I can come up with it. I really wanted to figure this one out using what you have taught me.
this is the part that is throwing me note it is not in the <h2> and <a> like the rest of the page is. I hope that explains what I mean. Hope I'm not bugging you on this. If so just say so and i'll chill