{"id":15017139,"url":"https://github.com/graphcentral/notion","last_synced_at":"2025-04-12T11:40:56.786Z","repository":{"id":57748568,"uuid":"522250701","full_name":"graphcentral/notion","owner":"graphcentral","description":"Knowledge graph for Notion, like obsidian.md or Roam research / https://graphcentral.github.io/graph","archived":false,"fork":false,"pushed_at":"2023-12-05T03:46:21.000Z","size":3169,"stargazers_count":82,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T06:23:30.994Z","etag":null,"topics":["force-directed-graph","graph","knowledge","knowledge-graph","notion","obsidian-md","roamresearch"],"latest_commit_sha":null,"homepage":"https://graphcentral.github.io/graph","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphcentral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-07T15:30:01.000Z","updated_at":"2025-03-25T08:32:26.000Z","dependencies_parsed_at":"2022-09-02T18:01:09.177Z","dependency_job_id":null,"html_url":"https://github.com/graphcentral/notion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphcentral%2Fnotion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphcentral%2Fnotion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphcentral%2Fnotion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphcentral%2Fnotion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphcentral","download_url":"https://codeload.github.com/graphcentral/notion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248562991,"owners_count":21125188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["force-directed-graph","graph","knowledge","knowledge-graph","notion","obsidian-md","roamresearch"],"created_at":"2024-09-24T19:49:56.411Z","updated_at":"2025-04-12T11:40:56.755Z","avatar_url":"https://github.com/graphcentral.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# notion\n\n![logo.png](./packages/notion-graph-scraper/logo.png)\n\n```bash\nnpm i --save @graphcentral/notion-graph-scraper\n```\n\nYou will be able to visualize the output from @graphcentral/notion-graph-scraper with [@graphcentral/graph](https://github.com/graphcentral/graph) like below:\n![doc1.png](./packages/notion-graph-scraper/doc1.png)\n\n## Example\n\nFirst, get a public Notion page (if you just want to test it out), preferably with some sub-pages inside it, so that you can get a graph with some nodes. You can also request private pages if you create your own instance of `NotionAPI` from `notion-client`. The example below is only for public pages.\n\nThen, get the id of the page like below:\n\n![doc0.png](./packages/notion-graph-scraper/doc0.png)\n\nThen, input the id of the page as a parameter to `notionGraph.buildGraphFromRootNode`\n\n```ts\nimport { NotionGraph } from \"@graphcentral/notion-graph-scraper\"\nimport fs from \"fs\"\n/**\n * example of how to use `@graphcentral/notion-graph-scraper`\n */\n;(async () =\u003e {\n  const notionGraph = new NotionGraph({\n    maxDiscoverableNodes: 2000,\n    maxDiscoverableNodesInOtherSpaces: 2000,\n    verbose: true,\n  })\n  const graph = await notionGraph.buildGraphFromRootNode(\n    // Some random Japanese blog\n    `95fcfe03257541c5aaa21dd43bdbc381`\n  )\n  console.log(graph.nodes.length)\n  console.log(graph.links.length)\n  await new Promise((resolve, reject) =\u003e {\n    fs.writeFile(`test0.json`, JSON.stringify(graph), (err) =\u003e {\n      if (err) reject(err)\n      else resolve(``)\n    })\n  });\n\n  process.exit(0)\n})()\n```\n\nThe graph will be an object of this type:\n\n```ts\n{\n  nodes: Node[]\n  links: Link[]\n  errors: Error[]\n}\n```\n\nThen, you can directly use this as an input to [@graphcentral/graph](https://github.com/graphcentral/graph) to visualize it on the web as a force layout graph.\n\n## Example setup\n\nAn example setup is at [@graphcentral/notion-scrape-example](https://github.com/graphcentral/notion-scrape-example).\n\n## Use ES6 module instead of Commonjs\n\nThis project uses es6 module (.mjs). Therefore, the following setup is needed:\n\nIn your `package.json`, specify \"type\" as \"module\"\n```json\n{\n  ...\n  \"type\": \"module\",\n  ...\n}\n```\n\nThen, using the latest version of node (this project uses whatever is specified in `.nvmrc` which is as of now `v16.15.1`), just run `node index.js` where `index.js` contains the previous example code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphcentral%2Fnotion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphcentral%2Fnotion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphcentral%2Fnotion/lists"}