| 
									
										
										
										
											2024-04-05 17:49:31 +02:00
										 |  |  | import Script from "./Script" | 
					
						
							|  |  |  | import LinkedDataLoader from "../src/Logic/Web/LinkedDataLoader" | 
					
						
							|  |  |  | import { writeFileSync } from "fs" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-19 03:22:57 +02:00
										 |  |  | class DownloadLinkedDataList extends Script { | 
					
						
							| 
									
										
										
										
											2024-04-05 17:49:31 +02:00
										 |  |  |     constructor() { | 
					
						
							|  |  |  |         super("Downloads the localBusinesses from the given location. Usage: url [--no-proxy]") | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     async main([url, noProxy]: string[]): Promise<void> { | 
					
						
							|  |  |  |         const useProxy = noProxy !== "--no-proxy" | 
					
						
							| 
									
										
										
										
											2024-06-19 03:22:57 +02:00
										 |  |  |         const data = await LinkedDataLoader.fetchJsonLd(url, {}, useProxy ? "proxy" : "fetch-lod") | 
					
						
							| 
									
										
										
										
											2024-04-13 02:40:21 +02:00
										 |  |  |         const path = "linked_data_" + url.replace(/[^a-zA-Z0-9_]/g, "_") + ".jsonld" | 
					
						
							|  |  |  |         writeFileSync(path, JSON.stringify(data), "utf8") | 
					
						
							|  |  |  |         console.log("Written", path) | 
					
						
							| 
									
										
										
										
											2024-04-05 17:49:31 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | new DownloadLinkedDataList().run() |