summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-01-12 19:06:56 +0100
committerkdx <kikoodx@paranoici.org>2023-01-12 19:06:56 +0100
commitf9ca781f1222c95272b7f380460cf093821b5bee (patch)
tree8d7ccf1823ab714ecf89b07d8d5d45f1342853be
parent42e637b9fb461bd1df67032900df7fd6436243cb (diff)
downloadcite-scrapper-f9ca781f1222c95272b7f380460cf093821b5bee.tar.gz
ignore french movies
-rw-r--r--.gitignore1
-rw-r--r--cite.c8
-rwxr-xr-xscrap.sh4
3 files changed, 9 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 85b937c..b15486f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
seances.xml
cite
cite.html
+citenofr.html
diff --git a/cite.c b/cite.c
index 9817345..8feb067 100644
--- a/cite.c
+++ b/cite.c
@@ -33,8 +33,10 @@ static void print_times(Movie *movie)
printf("</ul>\n");
}
-static void print_movie(Movie *movie)
+static void print_movie(Movie *movie, int hide_fr)
{
+ if (hide_fr && strcmp(movie->nationality, "France") == 0)
+ return;
if (movie->og_title[0] != '\0')
printf("<h2>%s</h2>\n", movie->og_title);
else
@@ -155,7 +157,7 @@ static int append_movie_times(Movie *movie, const xmlNode *node)
int main(int argc, char **argv)
{
- if (argc != 2)
+ if (argc != 3)
return 1;
xmlDoc *const document = xmlReadFile(argv[1], NULL, 0);
if (document == NULL) {
@@ -184,7 +186,7 @@ int main(int argc, char **argv)
print_style();
printf("<h1><a href=\"http://www.citebd.org/spip.php?film2912\">cinéma de la cité</a></h1>\n");
for (Movie *movie = movies; movie->id != 0; movie++)
- print_movie(movie);
+ print_movie(movie, atoi(argv[2]));
xmlFreeDoc(document);
xmlCleanupParser();
return 0;
diff --git a/scrap.sh b/scrap.sh
index 47ad12f..bb4862a 100755
--- a/scrap.sh
+++ b/scrap.sh
@@ -1,5 +1,7 @@
#!/bin/sh
./build.sh || exit 1
curl -o seances.xml 'http://www.citebd.org/IMG/xml/allocineseances-4.xml' || exit 1
-./cite seances.xml >cite.html || exit 1
+./cite seances.xml 0 >cite.html || exit 1
scp cite.html root@kdx.re:/var/www/html
+./cite seances.xml 1 >citenofr.html || exit 1
+scp citenofr.html root@kdx.re:/var/www/html