Datasets:
import requests | |
from bs4 import BeautifulSoup | |
def extract_mp3_link(page_url): | |
try: | |
response = requests.get(page_url) | |
response.raise_for_status() | |
soup = BeautifulSoup(response.text, "html.parser") | |
audio_div = soup.find("div", class_="jsAudioPlayer") | |
mp3_link = audio_div.find("a", class_="streaming")["href"] | |
return mp3_link | |
except Exception as e: | |
print(f"Erreur lors de l'extraction du lien MP3 : {e}") | |
return None | |
url = "https://www.jw.org/mos/d-s%E1%BA%BDn-yiisi/biible/nwt/books/S%C9%A9ngre/50/" | |
extract_mp3_link(url) |