forked from MapComplete/MapComplete
More tweaks to the linked data loader
This commit is contained in:
parent
684932aebd
commit
734be4a702
5 changed files with 76 additions and 55 deletions
|
@ -2,14 +2,14 @@ import Script from "./Script"
|
|||
import LinkedDataLoader from "../src/Logic/Web/LinkedDataLoader"
|
||||
import { writeFileSync } from "fs"
|
||||
|
||||
export default class DownloadLinkedDataList extends Script {
|
||||
class DownloadLinkedDataList extends Script {
|
||||
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"
|
||||
const data = await LinkedDataLoader.fetchJsonLd(url, {}, useProxy)
|
||||
const data = await LinkedDataLoader.fetchJsonLd(url, {}, useProxy ? "proxy" : "fetch-lod")
|
||||
const path = "linked_data_" + url.replace(/[^a-zA-Z0-9_]/g, "_") + ".jsonld"
|
||||
writeFileSync(path, JSON.stringify(data), "utf8")
|
||||
console.log("Written", path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue