From 81e377037de63c12a3fb32b07a1094264dfcff04 Mon Sep 17 00:00:00 2001 From: dece Date: Wed, 2 Feb 2022 15:16:22 +0100 Subject: [PATCH] mediapart-edition --- mediapart-edition.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 mediapart-edition.py diff --git a/mediapart-edition.py b/mediapart-edition.py new file mode 100755 index 0000000..13675ac --- /dev/null +++ b/mediapart-edition.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +"""Get the current Mediapart edition. Requires requests and beautifulsoup4.""" + +import requests +from bs4 import BeautifulSoup + +html = requests.get("https://www.mediapart.fr").text +soup = BeautifulSoup(html, "html.parser") +text = soup.select("div.nav__title._sm")[0].text +print(text.strip())