2023-10-15 16:22:52 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
import os
|
|
|
|
import json
|
2024-02-03 18:57:39 +01:00
|
|
|
import sys
|
2023-10-15 16:22:52 +02:00
|
|
|
|
2024-02-03 18:57:39 +01:00
|
|
|
# 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)
|
2023-10-15 16:22:52 +02:00
|
|
|
|
2024-02-03 18:57:39 +01:00
|
|
|
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.extractor_facebook import *
|
2023-10-15 16:22:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-03 18:57:39 +01:00
|
|
|
if __name__ == "__main__":
|
2023-10-15 16:22:52 +02:00
|
|
|
|
2024-02-03 18:57:39 +01:00
|
|
|
u2e = URL2Events(ChromiumHeadlessDownloader(), FacebookEventExtractor(single_event=True))
|
2024-08-13 15:50:00 +02:00
|
|
|
url="https://www.facebook.com/events/877079547620370/877079557620369/?active_tab=about"
|
2023-11-11 16:55:04 +01:00
|
|
|
|
2024-02-03 18:57:39 +01:00
|
|
|
events = u2e.process(url, cache = "fb.html", published = True)
|
2023-11-11 16:55:04 +01:00
|
|
|
|
2024-02-03 18:57:39 +01:00
|
|
|
exportfile = "event-facebook.json"
|
|
|
|
print("Saving events to file {}".format(exportfile))
|
|
|
|
with open(exportfile, "w") as f:
|
|
|
|
json.dump(events, f, indent=4, default=str)
|
2023-11-11 16:55:04 +01:00
|
|
|
|