320 lines
8.5 KiB
JSON
320 lines
8.5 KiB
JSON
{
|
|
"name": "Memebot",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"resource": "image",
|
|
"operation": "analyze",
|
|
"modelId": {
|
|
"__rl": true,
|
|
"value": "models/gemini-flash-latest",
|
|
"mode": "list",
|
|
"cachedResultName": "models/gemini-flash-latest"
|
|
},
|
|
"text": "Generate an alt-text description, which is a description for people who can't see the image. Be sure to talk about the actual contents of it, do not interpret or assume anything. Start with a general description, then focus on the details. If the image is complex or has many different elements, please try to summarize it in around 5 sentences. If there is any text, state it verbatim. Do not assume genders. Write your alt-text on the next line:",
|
|
"imageUrls": "={{ $json.imageUrl }}",
|
|
"options": {}
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.googleGemini",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
448,
|
|
0
|
|
],
|
|
"id": "9b1cdf52-79ce-4a87-966a-8ec86ccbe20f",
|
|
"name": "Analyze an image",
|
|
"retryOnFail": true,
|
|
"executeOnce": true,
|
|
"credentials": {
|
|
"googlePalmApi": {
|
|
"id": "6ixlh1w0T5DaBTt7",
|
|
"name": "memebot"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// Loop over input items and extract the image URL from the 'content' field\nfor (const item of $input.all()) {\n const content = item.json.content;\n\n // Use a regex to extract the image URL from the <img> tag\n const imgUrlMatch = content.match(/<img[^>]+src=\"([^\">]+)\"/);\n\n // If a match is found, add it to the new field 'imageUrl'\n item.json.imageUrl = imgUrlMatch ? imgUrlMatch[1] : null; // Set to null if no match found\n}\n\nreturn $input.all();\n"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
224,
|
|
0
|
|
],
|
|
"id": "fa26fc20-cc25-4c1e-b6e1-119495345bf1",
|
|
"name": "Extract Image URL"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "https://mastodon.social/api/v2/media",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBearerAuth",
|
|
"sendBody": true,
|
|
"contentType": "multipart-form-data",
|
|
"bodyParameters": {
|
|
"parameters": [
|
|
{
|
|
"parameterType": "formBinaryData",
|
|
"name": "file",
|
|
"inputDataFieldName": "data"
|
|
},
|
|
{
|
|
"name": "description",
|
|
"value": "=AI Generated Alt-Text:\n{{ $json.content.parts[0].text }}"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
1120,
|
|
0
|
|
],
|
|
"id": "bab8c886-65d6-465b-9db4-8e124459e0dc",
|
|
"name": "Upload Image",
|
|
"retryOnFail": true,
|
|
"executeOnce": true,
|
|
"alwaysOutputData": false,
|
|
"credentials": {
|
|
"httpBearerAuth": {
|
|
"id": "3yJLjOmfgP4pEaKK",
|
|
"name": "Mastodon: Memebot"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "https://mastodon.social/api/v1/statuses",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBearerAuth",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Idempotency-Key",
|
|
"value": "={{ $('Crypto').item.json.hash }}"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={\n \"status\": \"{{ $('RSS Read').item.json.title }}\\n\\n({{ $('RSS Read').item.json.link }})\",\n \"media_ids\": [\n \"{{ $json.id }}\"\n ]\n}\n",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
1344,
|
|
0
|
|
],
|
|
"id": "a03a540d-0896-4c48-8a0e-edb875b4fa3e",
|
|
"name": "Post Status",
|
|
"retryOnFail": true,
|
|
"executeOnce": true,
|
|
"credentials": {
|
|
"httpBearerAuth": {
|
|
"id": "3yJLjOmfgP4pEaKK",
|
|
"name": "Mastodon: Memebot"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "={{ $('Extract Image URL').item.json.imageUrl }}",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "User-Agent",
|
|
"value": "Wget/1.21 (linux-gnu) +http://www.gnu.org/software/wget/"
|
|
},
|
|
{
|
|
"name": "Accept",
|
|
"value": "image/webp,image/apng,image/*,*/*;q=0.8"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
896,
|
|
0
|
|
],
|
|
"id": "ae6e8993-5cad-4398-9b0e-72c9b78f1d34",
|
|
"name": "Download Image",
|
|
"retryOnFail": true,
|
|
"executeOnce": true
|
|
},
|
|
{
|
|
"parameters": {
|
|
"value": "={{ $('Extract Image URL').item.json.imageUrl }}",
|
|
"dataPropertyName": "hash"
|
|
},
|
|
"type": "n8n-nodes-base.crypto",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
672,
|
|
0
|
|
],
|
|
"id": "4a1f1a7d-3e08-475a-99c0-6dca4560aad6",
|
|
"name": "Crypto",
|
|
"executeOnce": true
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "https://rss.husch.ovh/?action=display&bridge=FilterBridge&url=https%3A%2F%2Frss.husch.ovh%2F%3Faction%3Ddisplay%26bridge%3DRedditBridge%26context%3Dsingle%26r%3Dmemes%26f%3D%26score%3D%26min_comments%3D-1%26d%3Dhot%26t%3Dweek%26search%3D%26frontend%3Dhttps%253A%252F%252Fold.reddit.com%26format%3DAtom&name=&filter=%3Cimg&filter_type=permit&target_content=on&length_limit=-1&format=Atom",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.rssFeedRead",
|
|
"typeVersion": 1.2,
|
|
"position": [
|
|
32,
|
|
0
|
|
],
|
|
"id": "96e26311-ba0d-4137-a0b7-81acbd91e127",
|
|
"name": "RSS Read",
|
|
"retryOnFail": true,
|
|
"executeOnce": true
|
|
},
|
|
{
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"field": "hours",
|
|
"hoursInterval": 3
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.3,
|
|
"position": [
|
|
-160,
|
|
0
|
|
],
|
|
"id": "99fe9ea9-1d30-4f7a-ab64-60d9e8d57262",
|
|
"name": "Schedule Trigger"
|
|
}
|
|
],
|
|
"pinData": {
|
|
"Schedule Trigger": [
|
|
{
|
|
"json": {
|
|
"timestamp": "2025-12-11T12:00:59.017-05:00",
|
|
"Readable date": "December 11th 2025, 12:00:59 pm",
|
|
"Readable time": "12:00:59 pm",
|
|
"Day of week": "Thursday",
|
|
"Year": "2025",
|
|
"Month": "December",
|
|
"Day of month": "11",
|
|
"Hour": "12",
|
|
"Minute": "00",
|
|
"Second": "59",
|
|
"Timezone": "America/New_York (UTC-05:00)"
|
|
},
|
|
"pairedItem": {
|
|
"item": 0
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"connections": {
|
|
"Analyze an image": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Crypto",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Extract Image URL": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Analyze an image",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Upload Image": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Post Status",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Download Image": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Upload Image",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Crypto": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Download Image",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"RSS Read": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Extract Image URL",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Schedule Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "RSS Read",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"active": true,
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"versionId": "145ebc51-2ed1-4135-9954-59ba5b1f813b",
|
|
"meta": {
|
|
"templateCredsSetupCompleted": true,
|
|
"instanceId": "20a72c777fdd0d77d5ad72a51179a06b6bcb946f6b9ad6ad9eda8698d56252f0"
|
|
},
|
|
"id": "nCPen92lZuTouyE0",
|
|
"tags": []
|
|
}
|