Skip to content

Instantly share code, notes, and snippets.

@taktamur
Last active January 3, 2025 21:41
Show Gist options
  • Save taktamur/873a6a8c55545b68bf0e4e94ed0896c9 to your computer and use it in GitHub Desktop.
Save taktamur/873a6a8c55545b68bf0e4e94ed0896c9 to your computer and use it in GitHub Desktop.
SoftwareDesign総集編の各号見出しのpdfを切り出して、特集集記事をテキスト起こしして、notionに放り込むまで。notionへの投入はn8nを使った
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"name": "SoftwareDesignをnotionに",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"id": "0a5bd26a-020e-4168-93ad-88fa499ec607",
"name": "When clicking ‘Test workflow’"
},
{
"parameters": {
"command": "ls -p \"/Users/tak/proj/jupyterlab/SoftwareDesign/sd_img\" | grep -v / | jq -R . | jq -s ."
},
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
220,
0
],
"id": "7d7469a2-53e1-4b9d-8dad-03cf5079a753",
"name": "Execute Command"
},
{
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.files = JSON.parse(item.json.stdout);\n}\n\nreturn $input.all();"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
440,
0
],
"id": "c57338b6-a625-445b-a8c1-97919f0112d6",
"name": "Code"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "af4e3561-11a8-4dbd-8b81-75c8a313dd4f",
"name": "files",
"value": "={{ $json.files }}",
"type": "array"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
660,
0
],
"id": "82246bb1-5016-46f2-9ff9-0d5524da5972",
"name": "Edit Fields"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
1320,
0
],
"id": "465a899b-f179-492c-bd69-58c1af72c7b2",
"name": "Loop Over Items"
},
{
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nconsole.log($input.all());\n\nreturn $input.all();"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1540,
120
],
"id": "e2dc55f7-0ece-45dc-b15f-a6bb9f765d5d",
"name": "Code1"
},
{
"parameters": {
"fieldToSplitOut": "files",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [
880,
0
],
"id": "da91398b-e12c-4c5e-a5bf-6ed5e5da4e05",
"name": "Split Out"
},
{
"parameters": {
"fileSelector": "=/Users/tak/proj/jupyterlab/SoftwareDesign/sd_img/{{ $json.files }}",
"options": {}
},
"type": "n8n-nodes-base.readWriteFile",
"typeVersion": 1,
"position": [
1760,
-20
],
"id": "a6a3689f-0b57-4361-b880-a0a6bddd2a46",
"name": "Read/Write Files from Disk"
},
{
"parameters": {
"operation": "binaryToPropery",
"options": {
"keepSource": "json"
}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
1980,
-20
],
"id": "d38bf4ec-35fe-4005-892b-278f92bf03b2",
"name": "Extract from File"
},
{
"parameters": {
"fileSelector": "=/Users/tak/proj/jupyterlab/SoftwareDesign/sd_json/{{ $json.files }}.json",
"options": {}
},
"type": "n8n-nodes-base.readWriteFile",
"typeVersion": 1,
"position": [
1760,
160
],
"id": "61110007-5308-457d-8116-5b431eec0272",
"name": "Read/Write Files from Disk1"
},
{
"parameters": {
"operation": "fromJson",
"options": {
"keepSource": "json"
}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
1980,
160
],
"id": "875dd841-464f-44ef-9762-87cf658d0cce",
"name": "Extract from File1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "618e9fb5-73e1-416e-9d90-c777be15e5df",
"name": "data.img",
"value": "={{ $json.data }}",
"type": "string"
},
{
"id": "5ce3e2f8-45fa-4ae9-a3f8-20a58059b18c",
"name": "data.fileName",
"value": "={{ $json.fileName }}.json",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2180,
-20
],
"id": "bae6a33f-0fa4-47a1-a0cc-3d3e401d40da",
"name": "Edit Fields1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "c9066bb7-6070-412b-b4f9-dd95e25a2da0",
"name": "data.title",
"value": "={{ $json.data.title }}",
"type": "string"
},
{
"id": "2fb5d8de-62ea-406d-8fe4-afa4cf0bb1c4",
"name": "data.text",
"value": "={{ $json.data.text }}",
"type": "string"
},
{
"id": "2bd73db4-6dd1-4529-8822-c8ae674bb05d",
"name": "data.fileName",
"value": "={{ $json.fileName }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2200,
160
],
"id": "57d18455-e1d6-405f-85df-f3c2df04d6df",
"name": "Edit Fields2"
},
{
"parameters": {
"mode": "combine",
"advanced": true,
"mergeByFields": {
"values": [
{
"field1": "data.fileName",
"field2": "data.fileName"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
2420,
120
],
"id": "97864b7f-7e77-4e43-b504-190e8d656825",
"name": "Merge"
},
{
"parameters": {
"resource": "databasePage",
"databaseId": {
"__rl": true,
"value": "16b326f0-8e38-806e-9289-fc5503cc0c21",
"mode": "list",
"cachedResultName": "SoftwareDesign総集編見出し",
"cachedResultUrl": "https://www.notion.so/16b326f08e38806e9289fc5503cc0c21"
},
"title": "={{ $json.data.title }}",
"blockUi": {
"blockValues": [
{
"textContent": "={{ $json.data.text }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.notion",
"typeVersion": 2.2,
"position": [
2640,
120
],
"id": "a65851a6-1331-4c67-869f-e9d2f823dbdc",
"name": "Notion",
"credentials": {
"notionApi": {
"id": "TJiWF5R1JHLYHgB5",
"name": "Notion account"
}
}
}
],
"pinData": {},
"connections": {
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Execute Command",
"type": "main",
"index": 0
}
]
]
},
"Execute Command": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Read/Write Files from Disk",
"type": "main",
"index": 0
},
{
"node": "Read/Write Files from Disk1",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Read/Write Files from Disk": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Read/Write Files from Disk1": {
"main": [
[
{
"node": "Extract from File1",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Extract from File1": {
"main": [
[
{
"node": "Edit Fields2",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Notion",
"type": "main",
"index": 0
}
]
]
},
"Notion": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "cedf3032-9378-44fc-a7a2-4bac27a77aff",
"meta": {
"instanceId": "6be6a7fcc827d9c757690034fe59425846319099aa90b9ddef9aeb85d9c582d2"
},
"id": "Zfe6JJjYa8k5SN8n",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment