你好!我在解析无线电台网站上的动态元素时遇到问题。这里您需要当前歌曲的名称
import requests
from bs4 import BeautifulSoup
songsNameList = []
url = f"https://top-radio.ru/web/russkij-xit"
q = requests.get(url)
result = q.content
soup = BeautifulSoup(result, 'lxml')
songs = soup.select("#se_igra")
for song in songs:
print(song.find('span'))
songsNameList.append(song.find('span'))
https://top-radio.ru/web/marusya-fm
包含在from POST字符串中的歌曲名称
,我有
我如何分析这个案例
这个网站使用java脚本。漂亮的汤是不够的。使用Selenium完成这样的任务。 你可以在这里读更多。 https://selenium-python.readthedocs.io/ 在这里你可以下载geckodriver for Firefox。 https://github.com/mozilla/geckodriver/releases 然后在代码中添加以下行:
相关问题 更多 >
编程相关推荐