@@ -29,7 +29,7 @@ from src.agenda_culturel.import_tasks.custom_extractors import *
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
 | 
			
		||||
    u2e = URL2Events(ChromiumHeadlessDownloader(), c3c.CExtractor())
 | 
			
		||||
    u2e = URL2Events(ChromiumHeadlessDownloader(), billetterie_cf.CExtractor())
 | 
			
		||||
    url = "https://billetterie-c3c.clermont-ferrand.fr/"
 | 
			
		||||
    url_human = "https://billetterie-c3c.clermont-ferrand.fr/"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										44
									
								
								experimentations/get_gds_events.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								experimentations/get_gds_events.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
#!/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)
 | 
			
		||||
sys.path.append(parent + "/src")
 | 
			
		||||
 | 
			
		||||
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__":
 | 
			
		||||
 | 
			
		||||
    u2e = URL2Events(ChromiumHeadlessDownloader(), billetterie_cf.CExtractor())
 | 
			
		||||
    url = "https://billetterie-gds.clermont-ferrand.fr/"
 | 
			
		||||
    url_human = "https://billetterie-gds.clermont-ferrand.fr/"
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        events = u2e.process(url, url_human, cache = "cache-gds.html", default_values = {}, published = True)
 | 
			
		||||
 | 
			
		||||
        exportfile = "events-gds.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))
 | 
			
		||||
		Reference in New Issue
	
	Block a user