diff --git a/fetchbs.py b/fetchbs.py new file mode 100755 index 0000000..fba128a --- /dev/null +++ b/fetchbs.py @@ -0,0 +1,22 @@ +#!/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() + +['\n\n 289\n ', '\n\n PAÏTA\n ', '\n\n TONTOUTA\n ', '\n\n 988 - Nouvelle-Calédonie\n ', "\n\n polygone délimité par les points :\n \n A : 166° 12' 46” E / 22° 00' 59” S\n \n B : 166° 12' 32” E / 22° 01' 26” S\n \n C : 166° 12' 51” E / 22° 01' 36” S\n \n D : 166° 13' 05” E / 22° 01' 11” S\n ", '\n\n Ministère des armées\n ', '\n'] \ No newline at end of file