2024-04-19 14:45:14 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
import os
|
|
|
|
import json
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# getting the name of the directory
|
|
|
|
# where the this file is present.
|
|
|
|
current = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
|
|
|
|
# Getting the parent directory name
|
|
|
|
# where the current directory is present.
|
|
|
|
parent = os.path.dirname(current)
|
|
|
|
|
|
|
|
# adding the parent directory to
|
|
|
|
# the sys.path.
|
|
|
|
sys.path.append(parent)
|
|
|
|
|
|
|
|
from src.agenda_culturel.import_tasks.downloader import *
|
|
|
|
from src.agenda_culturel.import_tasks.extractor import *
|
|
|
|
from src.agenda_culturel.import_tasks.importer import *
|
|
|
|
from src.agenda_culturel.import_tasks.custom_extractors import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
2024-04-22 09:42:23 +02:00
|
|
|
u2e = URL2Events(SimpleDownloader(), lacoope.CExtractor())
|
2024-04-19 14:45:14 +02:00
|
|
|
url = "https://www.lacoope.org/concerts-calendrier/"
|
|
|
|
url_human = "https://www.lacoope.org/concerts-calendrier/"
|
|
|
|
|
|
|
|
try:
|
2024-11-02 15:20:12 +01:00
|
|
|
events = u2e.process(url, url_human, cache = "cache-lacoope.html", default_values = {"category": "Fêtes & Concerts", "location": "La Coopérative"}, published = True)
|
2024-04-19 14:45:14 +02:00
|
|
|
|
|
|
|
exportfile = "events-lacoope.json"
|
|
|
|
print("Saving events to file {}".format(exportfile))
|
|
|
|
with open(exportfile, "w") as f:
|
|
|
|
json.dump(events, f, indent=4, default=str)
|
|
|
|
except Exception as e:
|
|
|
|
print("Exception: " + str(e))
|