defi-rendu-legifrance/fetchbs.py

23 lines
531 B
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Imports
import requests
from bs4 import BeautifulSoup
def runfetch():
site = requests.get("https://www.legifrance.gouv.fr/eli/arrete/2018/10/12/PRMD1824595A/jo/texte").text
soup = BeautifulSoup(site, "html.parser")
trs = soup.findAll("tr")
tds = []
for tr in trs:
tds.append([])
for td in BeautifulSoup(tr.prettify(), "html.parser").findAll("td"):
tds[-1].append(td.text)
print(trs)
if __name__ == "__main__":
runfetch()