{
  "version": "1.0.0",
  "exported_at": "2026-05-31T11:20:00.000Z",
  "project": {
    "name": "Trustpilot Reviews Scraper",
    "description": "Scrapes Trustpilot review listing pages by URL, including company metadata, overall rating, review count, reviewer details, review title/body/time, date of experience, and business replies. Uses multi-URL navigation for input Trustpilot review pages, then follows Trustpilot pagination by JavaScript URL navigation. Because Trustpilot may redirect to an authentication wall after many pages, this best-effort template caps pagination at 10 pages per input URL; edit MAX_PAGE in the pagination guard JavaScript if your session can access more pages. Results are appended to trustpilot_reviews_scraper_clean.csv.",
    "color": "bg-[#00b67a]",
    "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": {
        "urls": [
          "https://www.trustpilot.com/review/www.paddypower.com",
          "https://nl.trustpilot.com/review/stoxenergy.com?languages=all"
        ],
        "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": 220,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript on the page",
      "position_x": 840,
      "position_y": 220,
      "config": {
        "jsCode": "(() => {\n  const labels = ['accept all', 'accept cookies', 'accept', 'i accept', 'agree', 'ok', 'allow all'];\n  const buttons = Array.from(document.querySelectorAll('button, [role=\"button\"]'));\n  const btn = buttons.find(b => labels.includes((b.innerText || b.textContent || '').trim().toLowerCase()));\n  if (btn) btn.click();\n  document.querySelectorAll('[data-authentication-modal], [role=\"dialog\"][data-state=\"open\"], [class*=\"Modal_overlay\"], [class*=\"modal_overlay\"], [class*=\"CDS_Modal_overlay\"], .authentication-container_authentication__h_bIS').forEach(el => el.remove());\n  document.documentElement.style.overflow = 'auto';\n  document.body.style.overflow = 'auto';\n  return true;\n})()",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Wait for specified time",
      "position_x": 1200,
      "position_y": 220,
      "config": {
        "duration": 1
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1560,
      "position_y": 220,
      "config": {
        "selector": "article[data-service-review-card-paper]",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "inject-javascript-4",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript on the page",
      "position_x": 1920,
      "position_y": 220,
      "config": {
        "jsCode": "(() => {\n  const clean = s => (s || '').replace(/\\u00a0/g, ' ').replace(/\\s+/g, ' ').trim();\n  const text = clean(document.body.innerText || '');\n  const h1Raw = document.querySelector('h1')?.innerText || '';\n  const h1 = clean(h1Raw);\n  let company = '';\n  if (h1) {\n    const m = h1.match(/^(.+?)\\s+(?:Reviews|Beoordelingen|Avis)\\s*[\\d.,]+/i);\n    company = clean(m ? m[1] : h1.split(/\\s+-\\s+|\\s+\\|\\s+/)[0]);\n  }\n  if (!company) {\n    const og = document.querySelector('meta[property=\"og:title\"]')?.content || document.title || '';\n    company = clean(og.replace(/\\s+Reviews?.*$/i, '').replace(/\\s+Trustpilot.*$/i, ''));\n  }\n  let review_count = '';\n  let rc = h1.match(/(?:Reviews|Beoordelingen|Avis)\\s*([\\d.,]+)/i) || text.match(/(?:Reviews|Beoordelingen|Avis)\\s*([\\d.,]+)/i) || text.match(/([\\d.,]+)\\s+(?:reviews|beoordelingen|avis)/i);\n  if (rc) review_count = rc[0].length < 45 ? clean(rc[0]) : clean(rc[1]);\n  let overall_rating = '';\n  const ratingEls = Array.from(document.querySelectorAll('[data-rating-typography], [class*=\"rating\"] span, [class*=\"rating\"] p')).map(e => clean(e.innerText || e.textContent)).filter(Boolean);\n  overall_rating = ratingEls.find(t => /^\\d+[.,]\\d+$/.test(t)) || '';\n  if (!overall_rating) {\n    const rm = text.match(/TrustScore\\s*(\\d+[.,]\\d+)/i) || text.match(/Rated\\s*(\\d+[.,]\\d+)/i) || text.match(/Beoordeeld\\s*(\\d+[.,]\\d+)/i);\n    overall_rating = rm ? rm[1] : '';\n  }\n  let overall_evaluation = '';\n  const summaryCandidates = Array.from(document.querySelectorAll('[data-company-summary-card] p, [data-summary-card] p, [class*=\"summary\"] p, section p'))\n    .map(e => clean(e.innerText || e.textContent))\n    .filter(t => t.length > 80 && t.length < 1800 && /^(Reviewers|Consumers|Customers|Reviewers hadden|Consumenten|Klanten|Mensen)/i.test(t));\n  overall_evaluation = summaryCandidates[0] || '';\n  const verify_status = /verified company|verified business|geverifieerd bedrijf|geclaimd profiel|verific/i.test(text) ? '√' : '';\n  const visit = Array.from(document.querySelectorAll('a[href]')).find(a => /visit website|website bezoeken|bezoek website|visit site/i.test(a.innerText || ''));\n  const website = visit ? visit.href : '';\n  const canonical = document.querySelector('link[rel=\"canonical\"]')?.href || location.href;\n  const original_url = canonical.replace(/[?&]page=\\d+/i, '').replace(/[?&]sort=[^&]+/i, '');\n  const current_page = new URL(location.href).searchParams.get('page') || clean(document.querySelector('[aria-current=\"page\"], a[name=\"pagination-button-current\"]')?.innerText || '1');\n  window.__TP_META = { original_url, company, overall_rating, review_count, overall_evaluation, verify_status, website, current_page };\n  return window.__TP_META;\n})()",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 2280,
      "position_y": 220,
      "config": {
        "rowSelector": "article[data-service-review-card-paper]",
        "fileName": "trustpilot_reviews_scraper_clean.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "columns": [
          {
            "name": "original_url",
            "selector": "window.__TP_META?.original_url || location.href.replace(/[?&]page=\\d+/i, '')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "company",
            "selector": "window.__TP_META?.company || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "overall_rating",
            "selector": "window.__TP_META?.overall_rating || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_count",
            "selector": "window.__TP_META?.review_count || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "overall_evaluation",
            "selector": "window.__TP_META?.overall_evaluation || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "verify_status",
            "selector": "window.__TP_META?.verify_status || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "website",
            "selector": "window.__TP_META?.website || ''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "current_page",
            "selector": "window.__TP_META?.current_page || '1'",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "reviewer",
            "selector": "(() => { return ROW.querySelector('[data-consumer-name-typography]')?.innerText?.trim() || ROW.querySelector('aside a span')?.innerText?.trim() || ROW.querySelector('aside span')?.innerText?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "user_review_count",
            "selector": "(() => { const direct = ROW.querySelector('[data-consumer-reviews-count-typography]')?.innerText?.trim(); if (direct) return direct.replace(/[^0-9]/g, ''); const aside = ROW.querySelector('aside')?.innerText || ''; const m = aside.match(/(\\d+)\\s*(review|reviews|beoordeling|beoordelingen)/i); return m ? m[1] : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "country",
            "selector": "(() => { const direct = ROW.querySelector('[data-consumer-country-typography]')?.innerText?.trim(); if (direct) return direct; const aside = ROW.querySelector('aside')?.innerText || ''; const lines = aside.split('\\n').map(s => s.trim()).filter(Boolean); const countryLike = lines.find(s => /^[A-Z]{2}$/.test(s)); return countryLike || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating",
            "selector": "(() => { const img = ROW.querySelector('img[alt*=\"Rated\"], img[alt*=\"Beoordeeld\"], img[alt*=\"stars\"], img[alt*=\"sterren\"]'); if (img?.alt) return img.alt.trim(); const ratingNode = ROW.querySelector('[data-service-review-rating]'); return ratingNode?.getAttribute('data-service-review-rating') || ratingNode?.innerText?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_title",
            "selector": "(() => { return ROW.querySelector('[data-service-review-title-typography]')?.innerText?.trim() || ROW.querySelector('h2, h3')?.innerText?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_time",
            "selector": "(() => { const t = ROW.querySelector('time'); return t?.getAttribute('datetime') || t?.innerText?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "review_body",
            "selector": "(() => { return ROW.querySelector('[data-service-review-text-typography]')?.innerText?.trim() || ROW.querySelector('[data-service-review-text]')?.innerText?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "date_of_experience",
            "selector": "(() => { const direct = ROW.querySelector('[data-service-review-date-of-experience-typography]')?.innerText?.trim(); if (direct) return direct.replace(/^Date of experience:\\s*/i, '').replace(/^Datum van ervaring:\\s*/i, '').trim(); const txt = ROW.innerText || ''; const m = txt.match(/(?:Date of experience|Datum van ervaring):\\s*(.+)/i); return m ? m[1].split('\\n')[0].trim() : ''; })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "business_reply",
            "selector": "(() => { const direct = ROW.querySelector('[data-service-review-business-reply-text-typography], [data-business-unit-reply] p'); if (direct) return direct.innerText.trim(); const blocks = Array.from(ROW.querySelectorAll('section, div')).filter(e => /reply from|antwoord van|reactie van/i.test(e.innerText || '')); const block = blocks.find(e => (e.innerText || '').length > 30 && (e.innerText || '').length < 3000); if (!block) return ''; return (block.innerText || '').replace(/^(Reply from|Antwoord van|Reactie van).*?\\n/i, '').trim(); })()",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "business_reply_time",
            "selector": "(() => { const replyBlock = Array.from(ROW.querySelectorAll('[data-business-unit-reply], section, div')).find(e => /reply from|antwoord van|reactie van/i.test(e.innerText || '')); if (!replyBlock) return ''; const time = replyBlock.querySelector('time'); return time?.getAttribute('datetime') || time?.innerText?.trim() || ''; })()",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "inject-javascript-2",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript on the page",
      "position_x": 2640,
      "position_y": 220,
      "config": {
        "jsCode": "(() => {\n  const MAX_PAGE = 10;\n  document.querySelectorAll('[data-authentication-modal], [role=\"dialog\"][data-state=\"open\"], [class*=\"Modal_overlay\"], [class*=\"modal_overlay\"], [class*=\"CDS_Modal_overlay\"], .authentication-container_authentication__h_bIS').forEach(el => el.remove());\n  document.documentElement.style.overflow = 'auto';\n  document.body.style.overflow = 'auto';\n  const selector = 'a[name=\"pagination-button-next\"], a[aria-label=\"Next page\"], a[aria-label=\"Volgende pagina\"]';\n  const currentPage = parseInt(new URL(location.href).searchParams.get('page') || '1', 10);\n  document.querySelectorAll(selector).forEach(link => {\n    let nextPage = currentPage + 1;\n    try { nextPage = parseInt(new URL(link.href, location.href).searchParams.get('page') || String(currentPage + 1), 10); } catch (e) {}\n    if (currentPage >= MAX_PAGE || nextPage > MAX_PAGE) {\n      link.setAttribute('aria-disabled', 'true');\n      link.setAttribute('data-uscraper-page-limit', 'true');\n      link.removeAttribute('href');\n      link.remove();\n    }\n  });\n  return true;\n})()",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "element-exists-1",
      "block_type": "process",
      "title": "Element Exists",
      "description": "Check if element exists",
      "position_x": 3000,
      "position_y": 220,
      "config": {
        "selector": "a[name=\"pagination-button-next\"]:not([aria-disabled=\"true\"]), a[aria-label=\"Next page\"]:not([aria-disabled=\"true\"]), a[aria-label=\"Volgende pagina\"]:not([aria-disabled=\"true\"])"
      }
    },
    {
      "block_id": "inject-javascript-3",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript on the page",
      "position_x": 3000,
      "position_y": 560,
      "config": {
        "jsCode": "(() => {\n  document.querySelectorAll('[data-authentication-modal], [role=\"dialog\"][data-state=\"open\"], [class*=\"Modal_overlay\"], [class*=\"modal_overlay\"], [class*=\"CDS_Modal_overlay\"], .authentication-container_authentication__h_bIS').forEach(el => el.remove());\n  document.documentElement.style.overflow = 'auto';\n  document.body.style.overflow = 'auto';\n  const link = document.querySelector('a[name=\"pagination-button-next\"]:not([aria-disabled=\"true\"]), a[aria-label=\"Next page\"]:not([aria-disabled=\"true\"]), a[aria-label=\"Volgende pagina\"]:not([aria-disabled=\"true\"])');\n  if (link && link.href) {\n    window.location.href = link.href;\n    return link.href;\n  }\n  return '';\n})()",
        "waitForCompletion": true,
        "timeout": 10
      }
    },
    {
      "block_id": "wait-for-page-load-2",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 3360,
      "position_y": 560,
      "config": {
        "timeout": 30
      }
    },
    {
      "block_id": "wait-for-element-2",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 3720,
      "position_y": 560,
      "config": {
        "selector": "article[data-service-review-card-paper]",
        "timeout": 30,
        "visible": true
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 3000,
      "position_y": 900,
      "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": "inject-javascript-4",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-4",
      "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": "inject-javascript-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-2",
      "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": "inject-javascript-3",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "inject-javascript-3",
      "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": "wait-for-element-2",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-2",
      "from_connector_id": "right",
      "to_block_id": "inject-javascript-4",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "element-exists-1",
      "from_connector_id": "false",
      "to_block_id": "loop-continue-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": 3920,
      "height": 636,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "sleep-1",
          "wait-for-element-1",
          "wait-for-page-load-2",
          "wait-for-element-2"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 768,
      "position_y": 116,
      "width": 2480,
      "height": 636,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "inject-javascript-1",
          "inject-javascript-4",
          "inject-javascript-2",
          "inject-javascript-3"
        ]
      }
    },
    {
      "id": "group-extract",
      "element_type": "group",
      "title": "Data Extraction",
      "color": "#42be65",
      "position_x": 2208,
      "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": 2928,
      "position_y": 116,
      "width": 380,
      "height": 976,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "element-exists-1",
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Trustpilot review listing pages by URL, including company metadata, overall rating, review count, reviewer details, review title/body/time, date of experience, and business replies. Uses multi-URL navigation for input Trustpilot review pages, then follows Trustpilot pagination by JavaScript URL navigation. Because Trustpilot may redirect to an authentication wall after many pages, this best-effort template caps pagination at 10 pages per input URL; edit MAX_PAGE in the pagination guard JavaScript if your session can access more pages. Results are appended to trustpilot_reviews_scraper_clean.csv.",
      "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: `(() => {\n  const labels = ['accept all', 'accept cookies', 'accept', 'i accept', 'agree', 'ok', 'all...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1040,
      "position_y": 200,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-1"
      }
    },
    {
      "id": "note-block-inject-javascript-4",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => {\n  const clean = s => (s || '').replace(/\\u00a0/g, ' ').replace(/\\s+/g, ' ').trim();\n  const...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 2120,
      "position_y": 200,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-4"
      }
    },
    {
      "id": "note-block-structured-export-1",
      "element_type": "note",
      "title": "Note: Structured Export",
      "content": "Structured export with JS columns (original_url, company, overall_rating, review_count, overall_evaluation). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2480,
      "position_y": 200,
      "width": 340,
      "height": 137,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "id": "note-block-inject-javascript-2",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => {\n  const MAX_PAGE = 10;\n  document.querySelectorAll('[data-authentication-modal], [role=\"dia...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 2840,
      "position_y": 200,
      "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 `a[name=\"pagination-button-next\"]:not([aria-disabled=\"true\"]), a[aria-label=\"Next page\"]:not([aria-disabled=\"true\"]), a[a`. True / False branches control which path runs next. Keep enough space between branches so both connector lines are visible.",
      "color": "#ee5396",
      "position_x": 3200,
      "position_y": 200,
      "width": 340,
      "height": 170,
      "z_index": 22,
      "data": {
        "block_id": "element-exists-1"
      }
    },
    {
      "id": "note-block-inject-javascript-3",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(() => {\n  document.querySelectorAll('[data-authentication-modal], [role=\"dialog\"][data-state=\"open\"...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 3200,
      "position_y": 540,
      "width": 340,
      "height": 140,
      "z_index": 22,
      "data": {
        "block_id": "inject-javascript-3"
      }
    },
    {
      "id": "note-block-loop-continue-1",
      "element_type": "note",
      "title": "Note: Loop Continue",
      "content": "Loop Continue advances a multi-URL or multi-text loop. Place at the end of the loop body with a clear back-edge to the loop start.",
      "color": "#ee5396",
      "position_x": 3200,
      "position_y": 880,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}