Ich bin wieder einmal der Verzweiflung nahe. Ich versuche mit BeautifulSoup eine Yahoo News Site zu durchforschen. Mein Code sieht wie folgt aus:
Code: Alles auswählen
from bs4 import BeautifulSoup as soup # HTML data structure
from urllib.request import urlopen as uReq # Web client
# URl to web scrap from.
# we scrap "Daimler" from yahoo finance news
page_url = "https://finance.yahoo.com/quote/DAI.DE/?p=DAI.DE"
# opens the connection and downloads html page from url / loads it off and close it
uClient = uReq(page_url)
page_html = uClient.read()
uClient.close()
# parses html into a soup data structure to traverse html
page_soup = soup(page_html, "html.parser")
page_soup.h1
# Grabs each article
containers = page_soup.findAll("li",{"class":"js-stream-content Pos(r)"})
len(containers)
Code: Alles auswählen
containers = page_soup.findAll("li",{"class":"js-stream-content Pos(r)"})
Bin über jede Hilfe sehr dankbar!!!