From 27b65758985da4ad6ec7e17f5f6d0b5fc5d39a0d Mon Sep 17 00:00:00 2001 From: Tangui Morlier Date: Wed, 8 Feb 2023 18:54:15 +0100 Subject: [PATCH] =?UTF-8?q?Permet=20la=20r=C3=A9cup=C3=A9ration=20INAO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/download_parcellaire.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/download_parcellaire.sh b/bin/download_parcellaire.sh index 1a67abd..796a6f8 100755 --- a/bin/download_parcellaire.sh +++ b/bin/download_parcellaire.sh @@ -21,16 +21,12 @@ fi CVI="$cvi" PRODOUANE_USER="$PRODOUANE_USER" PRODOUANE_PASS="$PRODOUANE_PASS" node puppeteer_scrapping/prodouane_parcellaire.js -if [ ! -f "./documents/parcellaire-${cvi}-parcellaire.html" ]; then - echo "Échec du scraping" - exit 4 +if test -f "./documents/parcellaire-${cvi}-parcellaire.html"; then + sed -i '/^&1 fi -sed -i '/^&1 - if ! test -f "documents/parcellaire-${cvi}.csv" && test -f "$INAO_FILE"; then echo -n "Origine;CVI Operateur;Siret Operateur;Nom Operateur;Adresse Operateur;CP Operateur;Commune Operateur;Email Operateur;IDU;Commune;Lieu dit;Section;" > "documents/parcellaire-${cvi}.csv" echo "Numero parcelle;Produit;Cepage;Superficie;Superficie cadastrale;Campagne;Ecart pied;Ecart rang;Mode savoir faire;Statut;Date MaJ" >> "documents/parcellaire-${cvi}.csv" @@ -38,6 +34,11 @@ if ! test -f "documents/parcellaire-${cvi}.csv" && test -f "$INAO_FILE"; then fi #Code transitoire -if ! test -f "$INAO_FILE" && test -f "documents/parcellaire-${cvi}.csv" ; then +if ! test test -f "$INAO_FILE" && test -f "documents/parcellaire-${cvi}.csv" ; then sed -i 's/^[^;]*;//' "documents/parcellaire-${cvi}.csv" -fi \ No newline at end of file +fi + +if ! test -f "documents/parcellaire-${cvi}.csv"; then + echo "Échec du scraping" + exit 4 +fi