{
  "version": "1.0.0",
  "exported_at": "2026-06-02T03:00:00.000Z",
  "project": {
    "name": "Tripadvisor Hotel Scraper for germany",
    "description": "Scrapes Tripadvisor Germany hotel listing pages, starting from the Frankfurt hotel listing URL. Extracts city/keyword, page number, total result count, hotel image URL, hotel name, price, customer rating, review count, facilities/offers, and hotel URL. Pagination is handled by clicking the German/English next-page link until no enabled next link is found; results are appended to one CSV. Best-effort template: Tripadvisor may change markup, show consent dialogs, or apply bot protection.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 120,
      "position_y": 220,
      "config": {
        "url": "https://www.tripadvisor.de/Hotels-g187337-Frankfurt_Hesse-Hotels.html",
        "color": "bg-[#4589ff]",
        "tags": [
          "tripadvisor",
          "hotels",
          "germany"
        ]
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 456,
      "position_y": 220,
      "config": {
        "timeout": 40
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript on the page",
      "position_x": 792,
      "position_y": 220,
      "config": {
        "jsCode": "(() => { const candidates = Array.from(document.querySelectorAll('button, input[type=\"button\"], input[type=\"submit\"], a')); const accept = candidates.find(el => { const txt = ((el.innerText || el.value || el.getAttribute('aria-label') || '') + '').trim().toLowerCase(); const id = (el.id || '').toLowerCase(); return id.includes('accept') || id.includes('onetrust-accept') || txt === 'accept' || txt === 'akzeptieren' || txt.includes('alle akzeptieren') || txt.includes('zustimmen'); }); if (accept) { accept.click(); return 'Clicked cookie/consent button'; } return 'No cookie/consent button found'; })();",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1128,
      "position_y": 220,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1464,
      "position_y": 220,
      "config": {
        "selector": "[data-automation=\"hotel-card-title\"], [data-testid=\"hotel-card-title\"]",
        "timeout": 45,
        "visible": true
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1800,
      "position_y": 220,
      "config": {
        "rowSelector": "[data-automation=\"hotel-card-title\"], [data-testid=\"hotel-card-title\"]",
        "fileName": "tripadvisor-hotel-scraper-for-germany.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "keyword",
            "selector": "(() => { const path = decodeURIComponent(location.pathname); const m = path.match(/Hotels-g\\d+(?:-oa\\d+)?-([^\\/]+?)-Hotels/i); if (!m) return ''; const first = m[1].split('_')[0]; return first.replace(/-/g, ' ').trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "seite",
            "selector": "(() => { const m = location.pathname.match(/-oa(\\d+)-/i); return m ? String(Math.floor(parseInt(m[1], 10) / 30) + 1) : '1'; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "anzahl_der_moeglichkeiten",
            "selector": "(() => { const txt = document.body.innerText || ''; const m = txt.match(/([\\d\\.]+)\\s*(?:Hotels|Unterkünfte|Unterkuenfte|Möglichkeiten|Moeglichkeiten)/i); return m ? m[1].replace(/\\./g, '') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "image_url",
            "selector": "(() => { let card = ROW; for (let i = 0; i < 8 && card; i++) { if ((card.querySelector('img[src], source[srcset]')) && ((card.innerText || '').length > 30)) break; card = card.parentElement; } card = card || ROW; const img = card.querySelector('img[src], source[srcset]'); let v = img ? (img.getAttribute('src') || (img.getAttribute('srcset') || '').split(' ')[0]) : ''; return v ? new URL(v, location.href).href : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "name_des_hotels",
            "selector": "(() => { const txt = (ROW.innerText || ROW.textContent || '').trim(); return txt.replace(/^\\d+\\.\\s*/, '').split('\\n')[0].trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "preis",
            "selector": "(() => { let card = ROW; for (let i = 0; i < 8 && card; i++) { if (((card.innerText || '').match(/(?:€|\\$|£)\\s*\\d+|\\d+\\s*(?:€|\\$|£)/)) && ((card.innerText || '').length > 30)) break; card = card.parentElement; } card = card || ROW; const txt = card.innerText || ''; const m = txt.match(/(?:€|\\$|£)\\s*\\d+[\\.,]?\\d*|\\d+[\\.,]?\\d*\\s*(?:€|\\$|£)/); return m ? m[0].trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "kundenbewertung",
            "selector": "(() => { let card = ROW; for (let i = 0; i < 8 && card; i++) { if ((card.querySelector('[aria-label*=\"von 5\"], [aria-label*=\"of 5\"], [title*=\"von 5\"], [title*=\"of 5\"], [class*=\"bubble_\"]')) && ((card.innerText || '').length > 30)) break; card = card.parentElement; } card = card || ROW; const el = card.querySelector('[aria-label*=\"von 5\"], [aria-label*=\"of 5\"], [title*=\"von 5\"], [title*=\"of 5\"], [class*=\"bubble_\"]'); if (!el) return ''; const label = el.getAttribute('aria-label') || el.getAttribute('title') || ''; let m = label.match(/([0-5](?:[\\.,]\\d)?)/); if (m) return m[1].replace(',', '.'); const cls = el.getAttribute('class') || ''; m = cls.match(/bubble_(\\d+)/); return m ? (parseInt(m[1], 10) / 10).toFixed(1) : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "anzahl_der_bewertungen",
            "selector": "(() => { let card = ROW; for (let i = 0; i < 8 && card; i++) { if (((card.innerText || '').match(/[\\d\\.]+\\s*(Bewertungen|Rezensionen|reviews)/i)) && ((card.innerText || '').length > 30)) break; card = card.parentElement; } card = card || ROW; const txt = card.innerText || ''; const m = txt.match(/([\\d\\.]+)\\s*(?:Bewertungen|Rezensionen|reviews)/i); return m ? m[1].replace(/\\./g, '') : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "einrichtungen",
            "selector": "(() => { let card = ROW; for (let i = 0; i < 8 && card; i++) { if (((card.innerText || '').length > 80) && card.querySelector('img, a')) break; card = card.parentElement; } card = card || ROW; const lines = (card.innerText || '').split('\\n').map(s => s.trim()).filter(Boolean); const keep = lines.filter(l => /(Aktionsangebot|Sonderpreis|Rabatt|verfügbar|verfuegbar|Frühstück|Fruehstueck|WLAN|Pool|Park|Spa|Fitness|Restaurant|Bar|Haustiere|kostenlos)/i.test(l)); return Array.from(new Set(keep)).join(' | '); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "url",
            "selector": "(() => { let card = ROW; for (let i = 0; i < 8 && card; i++) { if (card.querySelector('a[href*=\"/Hotel_Review-\"]')) break; card = card.parentElement; } card = card || ROW; const a = (ROW.matches && ROW.matches('a[href]') ? ROW : ROW.querySelector('a[href]')) || card.querySelector('a[href*=\"/Hotel_Review-\"], a[href]'); const href = a ? a.getAttribute('href') : ''; return href ? new URL(href, location.href).href : ''; })()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 2136,
      "position_y": 220,
      "config": {
        "selector": "//a[(contains(@aria-label,'Nächste') or contains(@aria-label,'Weiter') or contains(@aria-label,'Next') or contains(normalize-space(.),'Weiter') or contains(normalize-space(.),'Next')) and not(@aria-disabled='true') and not(contains(@class,'disabled'))]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2472,
      "position_y": 520,
      "config": {
        "selector": "//a[(contains(@aria-label,'Nächste') or contains(@aria-label,'Weiter') or contains(@aria-label,'Next') or contains(normalize-space(.),'Weiter') or contains(normalize-space(.),'Next')) and not(@aria-disabled='true') and not(contains(@class,'disabled'))]",
        "timeout": 15
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 2808,
      "position_y": 520,
      "config": {
        "timeout": 40
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 3144,
      "position_y": 520,
      "config": {
        "duration": 3
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 3480,
      "position_y": 520,
      "config": {
        "selector": "[data-automation=\"hotel-card-title\"], [data-testid=\"hotel-card-title\"]",
        "timeout": 45,
        "visible": true
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 2136,
      "position_y": 520,
      "config": {}
    }
  ],
  "connections": [
    {
      "from_block_id": "navigate-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-page-load-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-page-load-1",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-1",
      "from_connector_id": "right",
      "to_block_id": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-1",
      "from_connector_id": "right",
      "to_block_id": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "element-exists-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "true",
      "to_block_id": "click-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "end-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "click-1",
      "from_connector_id": "right",
      "to_block_id": "wait-for-page-load-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-page-load-2",
      "from_connector_id": "right",
      "to_block_id": "sleep-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-2",
      "from_connector_id": "right",
      "to_block_id": "wait-for-element-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-2",
      "from_connector_id": "right",
      "to_block_id": "structured-export-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 116,
      "width": 3680,
      "height": 596,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "wait-for-page-load-2",
          "sleep-2",
          "wait-for-element-2"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 720,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 1728,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 2064,
      "position_y": 116,
      "width": 656,
      "height": 596,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "click-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 2064,
      "position_y": 416,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Tripadvisor Germany hotel listing pages, starting from the Frankfurt hotel listing URL. Extracts city/keyword, page number, total result count, hotel image URL, hotel name, price, customer rating, review count, facilities/offers, and hotel URL. Pagination is handled by clicking the German/English next-page link until no enabled next link is found; results are appended to one CSV. Best-effort template: Tripadvisor may change markup, show consent dialogs, or apply bot protection.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => { const candidates = Array.from(document.querySelectorAll('button, input[type=\"button\"], inpu...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 992,
      "position_y": 200,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (keyword, seite, anzahl_der_moeglichkeiten, image_url, name_des_hotels). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2000,
      "position_y": 200,
      "width": 340,
      "height": 137,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `//a[(contains(@aria-label,'Nächste') or contains(@aria-label,'Weiter') or contains(@aria-label,'Next') or contains(norma`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2336,
      "position_y": 200,
      "width": 340,
      "height": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-click-1",
      "element_type": "note",
      "title": "Note: Click",
      "content": "Uses XPath `//a[(contains(@aria-label,'Nächste') or contains(@aria-label,'Weiter') or contains(@aria-label,'Next`. XPath breaks easily if DOM structure changes.",
      "color": "#ee5396",
      "position_x": 2672,
      "position_y": 500,
      "width": 340,
      "height": 133,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    }
  ]
}