defi-rendu-legifrance/fetchbs.py

20 lines
527 B
Python
Raw Normal View History

#!/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__":
2018-11-06 21:19:48 +01:00
runfetch()