Hey,
ich versuche eine Windgeschwindigkeits-Tabelle zu parsen, aber mir fehlt noch die Idee, wie ich jetzt an die eigentlichen Werte ran komme. Im Moment bin ich so weit:
1 2 3 4 5 6 7 8 9 10 11 12 | #!/usr/bin/python3 from bs4 import BeautifulSoup as bs from requests import request url = "https://www.windfinder.com/forecast/rostock/print?units=c|kts|m|mm|sym|sym|24|hPa" r = request('GET', url) soup = bs(r.text,'html.parser') for ws in soup.find_all('td',text="Wind speed (kts)"): for wws in ws.next_siblings: print(wws) |
Was mir die Werte zusammen mit den Bildern zurückgibt.
<td>5<br/> <img alt="windspeed" class="windbar-print" src="//cdn.windfinder.com/prod/images/assets_print/ws2.182a6511.jpg" style="height: 10px; width: 100%;" title="windspeed"/> </td> <td>8<br/> <img alt="windspeed" class="windbar-print" src="//cdn.windfinder.com/prod/images/assets_print/ws4.4f5d0eb0.jpg" style="height: 16px; width: 100%;" title="windspeed"/> </td> <td>9<br/> <img alt="windspeed" class="windbar-print" src="//cdn.windfinder.com/prod/images/assets_print/ws4.4f5d0eb0.jpg" style="height: 16px; width: 100%;" title="windspeed"/> </td> <td>8<br/> <img alt="windspeed" class="windbar-print" src="//cdn.windfinder.com/prod/images/assets_print/ws3.b8105b8f.jpg" style="height: 14px; width: 100%;" title="windspeed"/> </td> <td>9<br/> <img alt="windspeed" class="windbar-print" src="//cdn.windfinder.com/prod/images/assets_print/ws4.4f5d0eb0.jpg" style="height: 16px; width: 100%;" title="windspeed"/> </td> <td>7<br/> <img alt="windspeed" class="windbar-print" src="//cdn.windfinder.com/prod/images/assets_print/ws3.b8105b8f.jpg" style="height: 12px; width: 100%;" title="windspeed"/> </td> ...
Wie komme ich jetzt allein an die Werte?
Danke & Viele Grüße,
Frink