{
  "name": "Computer Vision Articles Summary",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "4da75220-2795-45ff-b505-1c381de0de2a",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "language": "python",
        "pythonCode": "from bs4 import BeautifulSoup\n\nresults = []\n\n# Loop through incoming items (each should have HTML in `item.json.data`)\nfor item in _input.all():\n    html = item.json.get(\"data\", \"\")\n    if not html:\n        continue\n\n    soup = BeautifulSoup(html, \"html.parser\")\n\n    # Each paper is defined by <dt> (meta) and <dd> (details)\n    for dt, dd in zip(soup.find_all(\"dt\"), soup.find_all(\"dd\")):\n        # --- Extract title ---\n        title_tag = dd.find(\"div\", class_=\"list-title mathjax\")\n        title = (\n            title_tag.get_text(strip=True).replace(\"Title:\", \"\")\n            if title_tag else \"No title\"\n        )\n\n        # --- Extract abstract ---\n        abstract_tag = dd.find(\"p\", class_=\"mathjax\")\n        abstract = (\n            abstract_tag.get_text(strip=True)\n            if abstract_tag else \"No abstract\"\n        )\n\n        # --- Extract PDF link ---\n        pdf_link = None\n        for a in dt.find_all(\"a\"):\n            href = a.get(\"href\", \"\")\n            if \"pdf\" in href:\n                pdf_link = f\"https://arxiv.org{href}.pdf\"\n                break\n\n        # --- Append one result per paper ---\n        results.append({\n            \"title\": title,\n            \"download\": pdf_link\n        })\n\n# Return the list of results. Each dictionary in the list will become a separate item.\nreturn results"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        432,
        0
      ],
      "id": "9b4702c0-144f-4236-8d5d-ef6d53dfe617",
      "name": "Code in Python (Beta)"
    },
    {
      "parameters": {
        "url": "https://www.arxiv.org/list/cs.CV/recent",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "skip",
              "value": "0"
            },
            {
              "name": "show",
              "value": "2000"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
            },
            {
              "name": "accept-language",
              "value": "en-US,en;q=0.9,fa;q=0.8"
            },
            {
              "name": "priority",
              "value": "u=0, i"
            },
            {
              "name": "sec-ch-ua",
              "value": "\"Google Chrome\";v=\"141\", \"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"141\""
            },
            {
              "name": "sec-ch-ua-mobile",
              "value": "?0"
            },
            {
              "name": "sec-ch-ua-platform",
              "value": "\"macOS\""
            },
            {
              "name": "sec-fetch-dest",
              "value": "document"
            },
            {
              "name": "sec-fetch-mode",
              "value": "navigate"
            },
            {
              "name": "sec-fetch-site",
              "value": "none"
            },
            {
              "name": "sec-fetch-user",
              "value": "?1"
            },
            {
              "name": "upgrade-insecure-requests",
              "value": "1"
            },
            {
              "name": "user-agent",
              "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
            },
            {
              "name": "cookie",
              "value": "_ga=GA1.1.1933736800.1760440871;_ga_B1RR0QKWGQ=GS2.1.s1760440871$o1$g0$t1760440874$j57$l0$h0;arxiv_labs={%22sameSite%22:%22strict%22%2C%22expires%22:365};captchaAuth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJiY2IzOGM4YS1iZGVlLTQ2OTMtOTY5NS1hOWJiMzI0MWU1MGIiLCJleHAiOjE3NjA0NjEzMTksImlwIjoxNTcuMTM4Ljc2LjEyLCJpYXQiOjE3NjA0NTk1MjAsImlzcyI6IkZhc3RseSJ9.MHgyOWQ3NjE2ZjMwNDg0MTkyNjE4MmIwZDczZjA1YWRjODc2ZDE4NmNiMDM0Njg0MWUzNmE0NGRiZDM5YjdkYmM0;"
            }
          ]
        },
        "options": {
          "redirect": {
            "redirect": {}
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        224,
        0
      ],
      "id": "057ea5dc-120c-4603-9d5d-6158f2ae621d",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "messages": {
          "values": [
            {
              "content": "=Summarize the following article into IEEE-style JSON with the following exact schema:\n\n{\n  \"title\": \"string — concise, formal title of the article\",\n  \"authors\": [\"Author 1\", \"Author 2\", \"Author 3\"],\n  \"affiliation\": \"string — single-line institutional affiliation\",\n  \"abstract\": \"string — 2–4 sentences summarizing purpose, method, and conclusion\",\n  \"keywords\": [\"keyword1\", \"keyword2\", \"keyword3\", \"keyword4\", \"keyword5\"],\n  \"sections\": [\n    {\n      \"heading\": \"I. Introduction\",\n      \"content\": \"2–4 sentences summarizing context and problem statement.\n      list here all models used in the article\"\n    },\n    {\n      \"heading\": \"II. Related Work\",\n      \"content\": \"2–4 sentences summarizing relevant literature or context.\"\n    },\n    {\n      \"heading\": \"III. Methodology\",\n      \"content\": \"2–4 sentences explaining methods or workflow steps.\"\n    },\n    {\n      \"heading\": \"IV. Experimental Results\",\n      \"content\": \"2–4 sentences describing findings, metrics, or comparisons.also return the table of results here in html format with 2 - 4 sentence of explaination\"\n    },\n    {\n      \"heading\": \"V. Discussion\",\n      \"content\": \"2–4 sentences interpreting results and suggesting implications.\"\n    }\n  ],\n  \"acknowledgment\": \"string — one short sentence acknowledging contributions or support. Also put the link for downloading the article here as 'link': 'url'\"\n}\n\nOutput ONLY valid JSON. Do not include markdown or explanations.\n\nInput article:\ntitle: {{ $json[\"title\"] }}\nlink: {{ $json[\"download\"] }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        1104,
        0
      ],
      "id": "d1ad8585-922e-456b-93a4-e644cdcc08f0",
      "name": "Message a model",
      "credentials": {
        "googlePalmApi": {
          "id": "1c9wa457qSf8gf8N",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {
        "type": "random"
      },
      "type": "n8n-nodes-base.sort",
      "typeVersion": 1,
      "position": [
        640,
        0
      ],
      "id": "cf7fda19-d1ad-4600-a3e9-7409936592c4",
      "name": "Sort"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        864,
        0
      ],
      "id": "e1fa8189-7c8c-41bd-be8b-5ee32ab8cb8e",
      "name": "Limit"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "language": "python",
        "pythonCode": "import json\n\n# Extract and parse the AI output\nraw_text = _input.item.json.content.parts[0].text\nitem = json.loads(raw_text)\n\n# Format it into a structured dictionary\nresults = {\n    'title': str(item.get(\"title\")),\n    'authors': \", \".join(item.get(\"authors\", [])),\n    'affiliation': str(item.get(\"affiliation\")),\n    'abstract': str(item.get(\"abstract\")),\n    'keywords': \", \".join(item.get(\"keywords\", [])),\n    'sections': \"\\n\\n\".join([f\"{sec.get('heading', '')}\\n{sec.get('content', '')}\" for sec in item.get(\"sections\", [])]),\n    'acknowledgment': str(item.get(\"acknowledgment\"))\n}\n\nreturn results"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1408,
        0
      ],
      "id": "adca7415-7187-4fde-a8fa-94e0378042dd",
      "name": "Code in Python (Beta)1"
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "value": "public",
          "mode": "list",
          "cachedResultName": "public"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "article"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "authors",
              "displayName": "authors",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "affiliation",
              "displayName": "affiliation",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "abstract",
              "displayName": "abstract",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "keywords",
              "displayName": "keywords",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "sections",
              "displayName": "sections",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "acknowledgment",
              "displayName": "acknowledgment",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "created_at",
              "displayName": "created_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        1616,
        0
      ],
      "id": "f79d443b-4e0f-48a0-83cf-9f81397168e9",
      "name": "Insert rows in a table",
      "credentials": {
        "postgres": {
          "id": "7lV0bh2r3wwlG4wG",
          "name": "Postgres account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in Python (Beta)": {
      "main": [
        [
          {
            "node": "Sort",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Code in Python (Beta)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Code in Python (Beta)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in Python (Beta)1": {
      "main": [
        [
          {
            "node": "Insert rows in a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cdc44fdd-e8a4-401b-baa5-c4ccdce1fe00",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "272b58375a8c80e7c3bb5d0fb520f3e6b99d262a371c9a89e5b79e4130600186"
  },
  "id": "Js9yzziCvWSWZmSp",
  "tags": []
}