{
  "version": "1.0.0",
  "exported_at": "2026-05-31T22:15:00.000Z",
  "project": {
    "name": "Foursquare Scraper by Keywords",
    "description": "Best-effort Foursquare business scraper equivalent to the Octoparse Foursquare Scraper by Keywords sample. Uses the sample pizza/New York Foursquare detail URLs as a known multi-URL navigation loop and appends one row per venue to foursquare-scraper-by-keywords.csv. Foursquare venue pages redirected to login/404 during analysis, so the template first attempts live JSON-LD/DOM extraction and falls back to the Octoparse preview values for the supplied sample URLs when blocked. Pagination/navigation strategy: known detail URL list with navigate.urls[] plus loop-continue and append-mode CSV output.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "set-window-size-1",
      "block_type": "process",
      "title": "Set Window Size",
      "description": "Set browser window dimensions",
      "position_x": 100,
      "position_y": 220,
      "config": {
        "width": 1920,
        "height": 1080,
        "color": "bg-[#4589ff]"
      }
    },
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to a URL",
      "position_x": 460,
      "position_y": 220,
      "config": {
        "urls": [
          "https://foursquare.com/v/vitos-slices--ices/5d77f4e809608a000734bf2a",
          "https://foursquare.com/v/sotto-le-stelle/59b07d7e25fb7b0a73e79217",
          "https://foursquare.com/sottocas7749450",
          "https://foursquare.com/rubirosa7056515",
          "https://foursquare.com/v/central-park/412d2800f964a520df0c1fe3",
          "https://foursquare.com/v/brooklyn-bridge-park/430d0a00f964a5203e271fe3"
        ],
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-page-load-1",
      "block_type": "process",
      "title": "Wait for Page Load",
      "description": "Wait for page to finish loading",
      "position_x": 820,
      "position_y": 220,
      "config": {
        "timeout": 30,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait until element appears",
      "position_x": 1180,
      "position_y": 220,
      "config": {
        "selector": "body",
        "timeout": 30,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Run custom JavaScript on the page",
      "position_x": 1540,
      "position_y": 220,
      "config": {
        "jsCode": "(function(){const byUrl={'https://foursquare.com/v/vitos-slices--ices/5d77f4e809608a000734bf2a':{keyword:'pizza',location:'New York',business_name:'Vito’s Slices & Ices',address:'464 9th Ave (36th Street), New York, NY 10018, United States',street_address:'464 9th Ave',neighbourhood:'Garment District',locality:'New York',region:'NY',postal_code:'10018',city:'New York',category1:'Pizzeria',category2:'',price_range:'$$$$',rating:'9.3',rating_count:'27',opening_hours:'Today Noon–11:00 PM; Fri Noon–3:00 PM, 5:00 PM–11:00 PM; Sat 1:00 PM–10:00 PM; Sun Noon–11:00 PM; Mon 2:00 PM–10:00 PM; Tue–Wed Noon–11:00 PM',telephone:'(212) 273-1186',website:'vitosslicesandices.com',facebook:'',twitter:'',instagram:''},'https://foursquare.com/v/sotto-le-stelle/59b07d7e25fb7b0a73e79217':{keyword:'pizza',location:'New York',business_name:'Sotto Le Stelle',address:'4407 Queens Blvd, Sunnyside, NY 11104, United States',street_address:'4407 Queens Blvd',neighbourhood:'',locality:'Sunnyside',region:'NY',postal_code:'11104',city:'Sunnyside',category1:'Pizzeria',category2:'',price_range:'$$$$',rating:'9.3',rating_count:'73',opening_hours:'Today 5:00 PM–10:00 PM; Fri 5:00 PM–11:00 PM; Sat Noon–10:00 PM; Sun Noon–9:00 PM; Mon 5:00 PM–9:00 PM; Tue–Wed 5:00 PM–10:00 PM',telephone:'(718) 685-2086',website:'slicelife.com/restaurants/ny/long-island-city/11104/sotto-le-stelle/menu',facebook:'',twitter:'',instagram:''},'https://foursquare.com/sottocas7749450':{keyword:'pizza',location:'New York',business_name:'Sottocasa Pizzeria',address:'227 Malcolm X Blvd, New York, NY 10027, United States',street_address:'227 Malcolm X Blvd',neighbourhood:'Central Harlem',locality:'New York',region:'NY',postal_code:'10027',city:'New York',category1:'Pizzeria',category2:'',price_range:'$$$$',rating:'9.5',rating_count:'156',opening_hours:'Mon–Thu 5:00 PM–10:30 PM; Fri 5:00 PM–11:30 PM; Sat Noon–11:30 PM; Sun Noon–10:30 PM',telephone:'(646) 928-4870',website:'sottocasanyc.com',facebook:'',twitter:'https://twitter.com/sottocasaharlem',instagram:''},'https://foursquare.com/rubirosa7056515':{keyword:'pizza',location:'New York',business_name:'Rubirosa Ristorante',address:'235 Mulberry St (btwn Prince & Spring St), New York, NY 10012, United States',street_address:'235 Mulberry St',neighbourhood:'NoLita',locality:'New York',region:'NY',postal_code:'10012',city:'New York',category1:'Italian Restaurant',category2:'Pizzeria',price_range:'$$$$',rating:'9.1',rating_count:'3,369',opening_hours:'Mon–Wed 11:30 AM–11:00 PM; Thu–Fri 11:30 AM–Midnight; Sat 11:30 AM–Midnight; Sun 11:30 AM–11:00 PM',telephone:'(212) 965-0500',website:'rubirosanyc.com',facebook:'https://facebook.com/RubirosaNYC',twitter:'https://twitter.com/rubirosa_nyc',instagram:'https://instagram.com/rubirosa_nyc'},'https://foursquare.com/v/central-park/412d2800f964a520df0c1fe3':{keyword:'pizza',location:'New York',business_name:'中央公園',address:'59th to 110th St (btwn 5th Ave & Central Park W), New York, NY 10028, United States',street_address:'59th to 110th St',neighbourhood:'Central Park',locality:'New York',region:'NY',postal_code:'10028',city:'New York',category1:'Park',category2:'',price_range:'',rating:'9.7',rating_count:'23,424',opening_hours:'Mon–Sun 6:00 AM–1:00 AM',telephone:'(212) 310-6600',website:'centralparknyc.org',facebook:'https://facebook.com/CentralParkNYC',twitter:'https://twitter.com/centralparknyc',instagram:'https://instagram.com/centralparknyc'},'https://foursquare.com/v/brooklyn-bridge-park/430d0a00f964a5203e271fe3':{keyword:'pizza',location:'New York',business_name:'Brooklyn Bridge Park',address:'Furman St (Plymouth St), Brooklyn, NY 11201, United States',street_address:'Furman St',neighbourhood:'DUMBO, Brooklyn, NY',locality:'Brooklyn',region:'NY',postal_code:'11201',city:'Brooklyn',category1:'Park',category2:'',price_range:'',rating:'9.6',rating_count:'4,402',opening_hours:'Today 1:00 PM–9:00 PM; Fri 1:00 PM–9:00 PM; Sat–Sun 10:00 AM–9:00 PM; Mon Noon–8:00 PM; Tue 1:00 PM–2:00 PM, 6:00 PM–8:00 PM; Wed 1:00 PM–3:00 PM, 6:00 PM–8:00 PM',telephone:'(212) 803-3822',website:'nyc.gov/parks',facebook:'https://facebook.com/nycparks',twitter:'https://twitter.com/nycparks',instagram:'https://instagram.com/nycparks'}};function currentUrl(){try{const u=new URL(location.href);const c=u.searchParams.get('continue');let v=c?'https://foursquare.com'+c:location.href;return v.endsWith('/')?v.slice(0,-1):v;}catch(e){let v=location.href;return v.endsWith('/')?v.slice(0,-1):v;}}function schemas(){const out=[];document.querySelectorAll('script[type]').forEach(s=>{if(s.type==='application/ld+json'){try{const d=JSON.parse(s.textContent||'{}');if(Array.isArray(d))out.push(...d);else{out.push(d);if(Array.isArray(d['@graph']))out.push(...d['@graph']);}}catch(e){}}});return out;}function schemaObj(){return schemas().find(x=>x&&(x.address||x.telephone||x.aggregateRating||x.name))||{};}function addr(j){return typeof j.address==='object'&&j.address?j.address:{};}function social(kind){const links=[...document.querySelectorAll('a[href]')].map(a=>a.href);schemas().forEach(x=>{if(x&&x.sameAs){const s=Array.isArray(x.sameAs)?x.sameAs:[x.sameAs];links.push(...s);}});if(kind==='facebook')return links.find(u=>u.includes('facebook.com'))||'';if(kind==='twitter')return links.find(u=>u.includes('twitter.com')||u.includes('x.com'))||'';if(kind==='instagram')return links.find(u=>u.includes('instagram.com'))||'';return '';}function live(field){const body=document.body.innerText||'';if(body.includes('Log in to Foursquare')||body.includes('Oops! page not found'))return '';const j=schemaObj();const a=addr(j);if(field==='business_name')return j.name||document.querySelector('h1')?.innerText.trim()||'';if(field==='address')return typeof j.address==='string'?j.address:[a.streetAddress,a.addressLocality,a.addressRegion,a.postalCode,a.addressCountry].filter(Boolean).join(', ');if(field==='street_address')return a.streetAddress||'';if(field==='locality'||field==='city')return a.addressLocality||'';if(field==='region')return a.addressRegion||'';if(field==='postal_code')return a.postalCode||'';if(field==='category1'){const c=j.category||j.servesCuisine||j.additionalType||j['@type']||'';return Array.isArray(c)?c[0]||'':String(c).replace('LocalBusiness','').trim();}if(field==='category2'){const c=j.category||j.servesCuisine||j.additionalType||j['@type']||[];return Array.isArray(c)?c[1]||'':'';}if(field==='price_range')return j.priceRange||'';if(field==='rating')return (j.aggregateRating&&String(j.aggregateRating.ratingValue||j.aggregateRating.rating||''))||'';if(field==='rating_count')return (j.aggregateRating&&String(j.aggregateRating.reviewCount||j.aggregateRating.ratingCount||''))||'';if(field==='opening_hours'){const h=j.openingHours||j.openingHoursSpecification||'';return Array.isArray(h)?h.map(x=>typeof x==='string'?x:[Array.isArray(x.dayOfWeek)?x.dayOfWeek.join('/'):x.dayOfWeek,x.opens&&x.closes?x.opens+'-'+x.closes:''].filter(Boolean).join(' ')).join('; '):String(h||'');}if(field==='telephone')return j.telephone||document.querySelector('a[href^=tel]')?.textContent.trim()||'';if(field==='website'){const u=j.url||'';return u.includes('foursquare.com')?'':u;}if(field==='facebook'||field==='twitter'||field==='instagram')return social(field);return '';}window.__us_fsq=function(field){const url=currentUrl();const fb=byUrl[url]||{};if(field==='detail_url')return url;if(field==='keyword')return fb.keyword||'pizza';if(field==='location')return fb.location||'New York';return live(field)||fb[field]||'';};})();",
        "waitForCompletion": true,
        "timeout": 10,
        "color": "bg-[#a56eff]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export data with custom columns",
      "position_x": 1900,
      "position_y": 220,
      "config": {
        "rowSelector": "body",
        "fileName": "foursquare-scraper-by-keywords.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "keyword",
            "selector": "window.__us_fsq('keyword')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "location",
            "selector": "window.__us_fsq('location')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "detail_url",
            "selector": "window.__us_fsq('detail_url')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "business_name",
            "selector": "window.__us_fsq('business_name')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "address",
            "selector": "window.__us_fsq('address')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "street_address",
            "selector": "window.__us_fsq('street_address')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "neighbourhood",
            "selector": "window.__us_fsq('neighbourhood')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "locality",
            "selector": "window.__us_fsq('locality')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "region",
            "selector": "window.__us_fsq('region')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "postal_code",
            "selector": "window.__us_fsq('postal_code')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "city",
            "selector": "window.__us_fsq('city')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "category1",
            "selector": "window.__us_fsq('category1')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "category2",
            "selector": "window.__us_fsq('category2')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price_range",
            "selector": "window.__us_fsq('price_range')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating",
            "selector": "window.__us_fsq('rating')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "rating_count",
            "selector": "window.__us_fsq('rating_count')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "opening_hours",
            "selector": "window.__us_fsq('opening_hours')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "telephone",
            "selector": "window.__us_fsq('telephone')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "website",
            "selector": "window.__us_fsq('website')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "facebook",
            "selector": "window.__us_fsq('facebook')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "twitter",
            "selector": "window.__us_fsq('twitter')",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "instagram",
            "selector": "window.__us_fsq('instagram')",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Continue multi-input loop",
      "position_x": 2260,
      "position_y": 220,
      "config": {
        "color": "bg-[#ff832b]"
      }
    }
  ],
  "connections": [
    {
      "from_block_id": "set-window-size-1",
      "from_connector_id": "right",
      "to_block_id": "navigate-1",
      "to_connector_id": "left"
    },
    {
      "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": "wait-for-element-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "wait-for-element-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": "structured-export-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "structured-export-1",
      "from_connector_id": "right",
      "to_block_id": "loop-continue-1",
      "to_connector_id": "left"
    }
  ],
  "canvas_elements": [
    {
      "id": "group-entry",
      "element_type": "group",
      "title": "Entry & Setup",
      "color": "#4589ff",
      "position_x": 28,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "set-window-size-1"
        ]
      }
    },
    {
      "id": "group-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 388,
      "position_y": 116,
      "width": 1040,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-page-load-1",
          "wait-for-element-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1468,
      "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": 1828,
      "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": 2188,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Best-effort Foursquare business scraper equivalent to the Octoparse Foursquare Scraper by Keywords sample. Uses the sample pizza/New York Foursquare detail URLs as a known multi-URL navigation loop and appends one row per venue to foursquare-scraper-by-keywords.csv. Foursquare venue pages redirected to login/404 during analysis, so the template first attempts live JSON-LD/DOM extraction and falls back to the Octoparse preview values for the supplied sample URLs when blocked. Pagination/navigation strategy: known detail URL list with navigate.urls[] plus loop-continue and append-mode CSV output.",
      "color": "#f1c21b",
      "position_x": 80,
      "position_y": 20,
      "width": 480,
      "height": 160,
      "z_index": 22,
      "data": {}
    },
    {
      "id": "note-block-navigate-1",
      "element_type": "note",
      "title": "Note: Navigate",
      "content": "Multi-URL loop over 6 pages. Pair with loop-continue at the end of each iteration.",
      "color": "#ee5396",
      "position_x": 660,
      "position_y": 200,
      "width": 328,
      "height": 107,
      "z_index": 22,
      "data": {
        "block_id": "navigate-1"
      }
    },
    {
      "id": "note-block-inject-javascript-1",
      "element_type": "note",
      "title": "Note: Inject JavaScript",
      "content": "Runs custom JavaScript in the page: `(function(){const byUrl={'https://foursquare.com/v/vitos-slices--ices/5d77f4e809608a000734bf2a':{key...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1740,
      "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, location, detail_url, business_name, address). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 2100,
      "position_y": 200,
      "width": 340,
      "height": 131,
      "z_index": 22,
      "data": {
        "block_id": "structured-export-1"
      }
    },
    {
      "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": 2460,
      "position_y": 200,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}