Python, Web Scraping [Duplikat]

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Python, Web Scraping [Duplikat]

by Anonymous » 26 Aug 2025, 09:35

Ich habe versucht, eine Website mit BeautifulSoup zu schaben, und unabhängig von der Methode oder der Auswahl versuche ich, dass sie immer eine leere Liste zurückgibt. Dies sollte die Top 1001 -Songs auf dem Billboard -Diagramm < /p>
drucken

Code: Select all

from bs4 import BeautifulSoup
import requests

date = input("Which year do you want to travel to? Type the date in this format YYYY-MM-DD: ")

response = requests.get("https://www.billboard.com/charts/hot-100/" + date)

soup = BeautifulSoup(response.text, 'html.parser')
song_names_spans = soup.find_all("span", class_="chart-element__information__song")
song_names = [song.getText() for song in song_names_spans]

Top