Posts

Showing posts with the label beautifulsoup

Using BeautifulSoup to Search Yahoo Finance Statistics Page

Using BeautifulSoup to Search Yahoo Finance Statistics Page I am trying to scrape data out of the Yahoo Finance Statistics Page. In this instance, it is the "5 Year Average Dividend Yield". The data that I need is in this type of format. <tr> <td> <span>5 Year Average Dividend Yield</span> </td> <td class="Fz(s) Fw(500) Ta(end)">6.16</td> </tr> I'm new to beautifulsoup and I'm trying to read the bs4 doco, but have had no luck yet so far. I just realised that I was parsing through a table. (Yes, I'm a noob). Here's my code so far. It successfully prints out all the rows in the table. I need help with isolating the row that contains "5 Year Average Dividend Yield". I just need the numerical value in the next column. Thanks in advance. New edit: I've placed version 0.8 below which gets the "5 Year Average Dividend Yield" value that I was looking for. # Version 0.8 - This w...