{
  "version": "1.0.0",
  "exported_at": "2026-06-01T10:50:00.000Z",
  "project": {
    "name": "Google Hotel Scraper",
    "description": "Best-effort Google Travel Hotels scraper for keyword/location searches. Default URL searches hotels in Barcelona. The workflow opens Google Hotels, dismisses common consent prompts, scrolls dynamic result panels, clicks any visible More hotels / Mostrar más style load-more button until absent, then parses repeated Google Hotels amenity markers such as 'Servicios de ...' into one synthetic row per hotel. It exports hotel name, price, rating, label/type, deal/location tags, services, and image URLs to google-hotel-scraper.csv. Google may show CAPTCHA/consent pages or change DOM structure; solve CAPTCHA manually if prompted and edit the URL keyword/location as needed.",
    "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": 240,
      "config": {
        "url": "https://www.google.com/travel/hotels/Barcelona?hl=es&gl=US&curr=USD",
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 480,
      "position_y": 240,
      "config": {
        "timeout": 45
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript",
      "position_x": 840,
      "position_y": 240,
      "config": {
        "jsCode": "(() => { const patterns = /Accept all|I agree|Aceptar todo|Acepto|Aceptar|Agree|OK/i; const buttons = Array.from(document.querySelectorAll('button, [role=\"button\"], input[type=\"submit\"]')); const btn = buttons.find(b => patterns.test((b.innerText || b.value || '').trim())); if (btn) { btn.click(); return 'clicked_consent'; } return 'no_consent_button_found'; })()",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1200,
      "position_y": 240,
      "config": {
        "selector": "img[src*=\"googleusercontent.com\"]",
        "timeout": 45,
        "visible": true
      }
    },
    {
      "block_id": "inject-javascript-2",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript",
      "position_x": 1560,
      "position_y": 240,
      "config": {
        "jsCode": "(() => { window.scrollBy(0, 1400); Array.from(document.querySelectorAll('*')).filter(el => el.scrollHeight > el.clientHeight + 300).forEach(el => { el.scrollTop = Math.min(el.scrollTop + 1400, el.scrollHeight); }); return 'scrolled_page_and_result_panels'; })()",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1920,
      "position_y": 240,
      "config": {
        "duration": 2
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 2280,
      "position_y": 240,
      "config": {
        "selector": "//button[contains(., 'More hotels') or contains(., 'More results') or contains(., 'Show more') or contains(., 'Mostrar más') or contains(., 'Más hoteles') or contains(., 'Ver más')]"
      }
    },
    {
      "block_id": "click-1",
      "block_type": "process",
      "title": "Click",
      "description": "Click on element",
      "position_x": 2280,
      "position_y": 560,
      "config": {
        "selector": "//button[contains(., 'More hotels') or contains(., 'More results') or contains(., 'Show more') or contains(., 'Mostrar más') or contains(., 'Más hoteles') or contains(., 'Ver más')]",
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-2",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 2640,
      "position_y": 560,
      "config": {
        "duration": 3
      }
    },
    {
      "block_id": "inject-javascript-3",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript",
      "position_x": 2280,
      "position_y": 880,
      "config": {
        "jsCode": "(() => { const old = document.querySelector('#uscraper-hotels-data'); if (old) old.remove(); const clean = s => String(s || '').replace(/\\s+/g, ' ').trim(); const unique = arr => Array.from(new Set(arr.map(clean).filter(Boolean))); const imgUrls = unique(Array.from(document.images).map(img => img.currentSrc || img.src || '').filter(src => /googleusercontent\\.com/.test(src) && !src.startsWith('data:'))); const raw = clean(document.body.innerText || ''); const priceRe = /(?:US\\$|\\$|€|£)\\s?\\d[\\d.,]*|\\d[\\d.,]*\\s?US\\$/g; const ratingRe = /\\b[0-5][\\.,]\\d(?:\\/5)?\\s*(?:\\([^)]*\\))?(?:\\s*·\\s*(?:Cert\\. ecológica|Eco-certified))?/gi; const offerRe = /GRAN OFERTA|OFERTA|Great deal|Deal|Excelente ubicación|Excellent location|\\d+%\\s*(?:menos de lo habitual|below usual)/gi; const badName = /^(Moneda|Currency|Servicios|Amenities|Patrocinado|Sponsored|Barcelona hoteles|Barcelona hotels|Información|Privacidad|Términos|Privacy|Terms)$/i; const rows = []; const seen = new Set(); const svcRe = /(?:Servicios de|Amenities for)\\s+(.+?)(?:,\\s+un(?:a)?\\s+(.+?)\\s*\\.?:|,\\s+a\\s+(.+?)\\s*\\.?:|:)/gi; const matches = []; let m; while ((m = svcRe.exec(raw)) !== null) { matches.push({ idx: m.index, end: svcRe.lastIndex, name: clean(m[1]), label: clean(m[2] || m[3] || '') }); } const lastMatchBefore = (re, txt) => { const arr = txt.match(re); return arr && arr.length ? clean(arr[arr.length - 1]) : ''; }; const trimServices = txt => { let t = clean(txt.split(/\\b(?:Ver precios|Ver detalles|View prices|View details|See prices|See details|See availability|Reservar|Book)\\b/i)[0] || txt); t = clean(t.split(/\\bHotel de \\d estrellas?\\b|\\b\\d[ -]?star hotel\\b/i)[0] || t); return unique(t.split(/\\s*[·,|]\\s*/).map(x => x.replace(/^Servicios incluidos:?\\s*/i, '')).filter(x => x && x.length > 1 && x.length < 90 && !priceRe.test(x) && !/^(Ver precios|Ver detalles|View prices|View details)$/i.test(x))).slice(0, 20).join(' | '); }; for (let i = 0; i < matches.length; i++) { const cur = matches[i]; let name = clean(cur.name.replace(/^(el|la|the)\\s+/i, '')); if (!name || badName.test(name) || name.length > 130) continue; const prevBoundaryCandidates = ['Ver precios', 'Ver detalles', 'View prices', 'View details', 'See prices', 'See details', 'See availability']; let b = 0; const prevTextAll = raw.slice(0, cur.idx); for (const token of prevBoundaryCandidates) { const p = prevTextAll.lastIndexOf(token); if (p > b) b = p + token.length; } const prev = raw.slice(Math.max(0, b), cur.idx); const nextEnd = i + 1 < matches.length ? matches[i + 1].idx : raw.length; const after = raw.slice(cur.end, nextEnd); const price = lastMatchBefore(priceRe, prev); const rating = lastMatchBefore(ratingRe, prev); const offers = unique(prev.match(offerRe) || []).join(' | '); let label = cur.label || ''; const services = trimServices(after); const sig = (name + '|' + price + '|' + rating).toLowerCase(); if (seen.has(sig)) continue; seen.add(sig); rows.push({ hotel: name, precio: price, calificacion: rating, etiqueta: label, oferta: offers, servicios: services }); } if (rows.length < 3) { const cardTexts = unique(Array.from(document.querySelectorAll('div, article, section')).map(el => clean(el.innerText || '')).filter(t => /(?:Servicios de|Amenities for)/i.test(t) && (priceRe.test(t) || ratingRe.test(t)) && t.length > 80 && t.length < 2000)); for (const txt of cardTexts) { const sm = txt.match(/(?:Servicios de|Amenities for)\\s+(.+?)(?:,\\s+un(?:a)?\\s+(.+?)\\s*\\.?:|,\\s+a\\s+(.+?)\\s*\\.?:|:)/i); if (!sm) continue; const name = clean(sm[1]); if (!name || badName.test(name)) continue; const price = lastMatchBefore(priceRe, txt.slice(0, sm.index)); const rating = lastMatchBefore(ratingRe, txt.slice(0, sm.index)); const sig = (name + '|' + price + '|' + rating).toLowerCase(); if (seen.has(sig)) continue; seen.add(sig); rows.push({ hotel: name, precio: price, calificacion: rating, etiqueta: clean(sm[2] || sm[3] || ''), oferta: unique(txt.match(offerRe) || []).join(' | '), servicios: trimServices(txt.slice(sm.index + sm[0].length)) }); } } const wrap = document.createElement('div'); wrap.id = 'uscraper-hotels-data'; wrap.style.cssText = 'position:absolute;left:0;top:0;width:1px;height:1px;overflow:hidden;background:white;color:black;'; const addSpan = (row, cls, text) => { const s = document.createElement('span'); s.className = cls; s.textContent = text || ''; row.appendChild(s); }; const addImg = (row, cls, src) => { const img = document.createElement('img'); img.className = cls; if (src) img.src = src; row.appendChild(img); }; rows.forEach((d, i) => { const row = document.createElement('div'); row.className = 'uscraper-hotel-row'; addSpan(row, 'hotel', d.hotel); addSpan(row, 'precio', d.precio); addSpan(row, 'calificacion', d.calificacion); addSpan(row, 'etiqueta', d.etiqueta); addSpan(row, 'oferta', d.oferta); addSpan(row, 'servicios', d.servicios); addImg(row, 'imagen', imgUrls[i] || ''); addImg(row, 'imagen2', imgUrls[i + rows.length] || imgUrls[i + 1] || ''); wrap.appendChild(row); }); document.body.prepend(wrap); return 'created ' + rows.length + ' normalized hotel rows from ' + matches.length + ' service markers'; })()",
        "waitForCompletion": true,
        "timeout": 20
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 2640,
      "position_y": 880,
      "config": {
        "selector": "#uscraper-hotels-data .uscraper-hotel-row",
        "timeout": 10,
        "visible": false
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 3000,
      "position_y": 880,
      "config": {
        "rowSelector": "#uscraper-hotels-data .uscraper-hotel-row",
        "fileName": "google-hotel-scraper.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "create",
        "columns": [
          {
            "name": "hotel",
            "selector": ".hotel",
            "attribute": "text"
          },
          {
            "name": "precio",
            "selector": ".precio",
            "attribute": "text"
          },
          {
            "name": "calificacion",
            "selector": ".calificacion",
            "attribute": "text"
          },
          {
            "name": "etiqueta",
            "selector": ".etiqueta",
            "attribute": "text"
          },
          {
            "name": "oferta",
            "selector": ".oferta",
            "attribute": "text"
          },
          {
            "name": "servicios",
            "selector": ".servicios",
            "attribute": "text"
          },
          {
            "name": "imagen",
            "selector": "img.imagen",
            "attribute": "src"
          },
          {
            "name": "imagen2",
            "selector": "img.imagen2",
            "attribute": "src"
          }
        ]
      }
    },
    {
      "block_id": "end-1",
      "block_type": "output",
      "title": "End",
      "description": "Terminate execution flow",
      "position_x": 3360,
      "position_y": 880,
      "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": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-1",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-2",
      "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": "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": "click-1",
      "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": "inject-javascript-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "inject-javascript-3",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-3",
      "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"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "end-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 136,
      "width": 2840,
      "height": 936,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1",
          "sleep-1",
          "sleep-2",
          "wait-for-element-2"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 768,
      "position_y": 136,
      "width": 1760,
      "height": 936,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1",
          "inject-javascript-2",
          "inject-javascript-3"
        ]
      }
    },
    {
      "id": "group-pagination",
      "element_type": "group",
      "title": "Pagination Loop",
      "color": "#ff832b",
      "position_x": 2208,
      "position_y": 136,
      "width": 380,
      "height": 616,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "click-1"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 2928,
      "position_y": 776,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "structured-export-1"
        ]
      }
    },
    {
      "id": "group-control",
      "element_type": "group",
      "title": "Control Flow",
      "color": "#8d8d8d",
      "position_x": 3288,
      "position_y": 776,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "end-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort Google Travel Hotels scraper for keyword/location searches. Default URL searches hotels in Barcelona. The workflow opens Google Hotels, dismisses common consent prompts, scrolls dynamic result panels, clicks any visible More hotels / Mostrar más style load-more button until absent, then parses repeated Google Hotels amenity markers such as 'Servicios de ...' into one synthetic row per hotel. It exports hotel name, price, rating, label/type, deal/location tags, services, and image URLs to google-hotel-scraper.csv. Google may show CAPTCHA/consent pages or change DOM structure; solve CAPTCHA manually if prompted and edit the URL keyword/location as needed.",
      "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 patterns = /Accept all|I agree|Aceptar todo|Acepto|Aceptar|Agree|OK/i; const buttons ...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1040,
      "position_y": 220,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-inject-javascript-2",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => { window.scrollBy(0, 1400); Array.from(document.querySelectorAll('*')).filter(el => el.scroll...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1760,
      "position_y": 220,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-2"
      }
    },
    {
      "id": "note-block-element-exists-1",
      "element_type": "note",
      "title": "Note: Element Exists",
      "content": "Condition block: checks `//button[contains(., 'More hotels') or contains(., 'More results') or contains(., 'Show more') or contains(., 'Mostrar m`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 2480,
      "position_y": 220,
      "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 `//button[contains(., 'More hotels') or contains(., 'More results') or contains(., 'Show more') or co`. XPath breaks easily if DOM structure changes.",
      "color": "#ee5396",
      "position_x": 2480,
      "position_y": 540,
      "width": 340,
      "height": 133,
      "z_index": 22,
      "data": {
        "block_id": "click-1"
      }
    },
    {
      "id": "note-block-inject-javascript-3",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => { const old = document.querySelector('#uscraper-hotels-data'); if (old) old.remove(); const c...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 2480,
      "position_y": 860,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-3"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Extracts rows matching `#uscraper-hotels-data .uscraper-hotel-row`. Confirm row count > 0 before running at scale.",
      "color": "#ee5396",
      "position_x": 3200,
      "position_y": 860,
      "width": 340,
      "height": 118,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    }
  ]
}