{
  "version": "1.0.0",
  "exported_at": "2026-06-02T01:10:00.000Z",
  "project": {
    "name": "Mercari Product Details Scraping by URL Cloud Only",
    "description": "Scrapes Mercari Japan product detail pages from a provided list of product URLs. Navigation uses a multi-URL Navigate loop plus Loop Continue, so every URL in the urls array is exported into one appended CSV. This is a best-effort equivalent of the Octoparse Mercari product detail scraper; it uses embedded JSON, meta tags, and visible Japanese labels because Mercari may dynamically hydrate pages, show loading skeletons, CAPTCHA, or anti-bot blocking.",
    "color": "bg-[#4589ff]",
    "template_id": "ai-generated"
  },
  "blocks": [
    {
      "block_id": "navigate-1",
      "block_type": "process",
      "title": "Navigate",
      "description": "Go to each Mercari product URL",
      "position_x": 120,
      "position_y": 220,
      "config": {
        "urls": [
          "https://jp.mercari.com/item/m52132288536",
          "https://jp.mercari.com/item/m66922244590",
          "https://jp.mercari.com/item/m93126071906",
          "https://jp.mercari.com/item/m26616930065",
          "https://jp.mercari.com/item/m31127575735"
        ],
        "color": "bg-[#4589ff]",
        "tags": [
          "mercari",
          "product-url-loop"
        ]
      }
    },
    {
      "block_id": "wait-for-element-1",
      "block_type": "process",
      "title": "Wait for Element",
      "description": "Wait for page body",
      "position_x": 480,
      "position_y": 220,
      "config": {
        "selector": "body",
        "timeout": 30,
        "visible": true,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "sleep-1",
      "block_type": "process",
      "title": "Sleep",
      "description": "Allow Mercari client-side data to hydrate",
      "position_x": 840,
      "position_y": 220,
      "config": {
        "duration": 4,
        "color": "bg-[#08bdba]"
      }
    },
    {
      "block_id": "inject-javascript-1",
      "block_type": "process",
      "title": "Inject JavaScript",
      "description": "Normalize Mercari item data into window.__US_MERCARI_ITEM__",
      "position_x": 1200,
      "position_y": 220,
      "config": {
        "jsCode": "(function(){const meta=n=>{const el=Array.from(document.getElementsByTagName('meta')).find(e=>e.getAttribute('property')===n||e.getAttribute('name')===n);return el?el.content:''};const objs=[];const walk=v=>{if(!v||typeof v!=='object')return;if(Array.isArray(v)){v.forEach(walk);return}objs.push(v);Object.values(v).forEach(walk)};Array.from(document.scripts).forEach(s=>{const t=(s.textContent||'').trim();try{if(t[0]==='{'||t[0]==='[')walk(JSON.parse(t))}catch(e){}});const id=(location.pathname.match(/m\\d+/)||[''])[0];const candidates=[];objs.forEach(o=>{if(!o||typeof o!=='object')return;if(o.item&&typeof o.item==='object')candidates.push(o.item);if(o.data&&o.data.item&&typeof o.data.item==='object')candidates.push(o.data.item);candidates.push(o)});let item=candidates.find(o=>(String(o.id||o.item_id||o.itemId||'')===id)&&(o.name||o.title||o.description))||candidates.find(o=>(o.item_category||o.itemCategory||o.shipping_payer||o.shippingPayer||o.shipping_method||o.shippingMethod)&&(o.name||o.title||o.description))||candidates.find(o=>o.name&&(o.price||o.photos||o.photo_urls||o.image))||{};const value=v=>{if(v==null)return '';if(Array.isArray(v))return v.map(value).filter(Boolean).join(';');if(typeof v==='object')return String(v.name||v.label||v.title||v.value||v.text||v.url||v.src||'');return String(v)};const first=(...a)=>a.find(v=>v!==undefined&&v!==null&&value(v)!=='');const lines=(document.body.innerText||'').split('\\n').map(x=>x.trim()).filter(Boolean);const after=label=>{let i=lines.indexOf(label);if(i>=0&&lines[i+1])return lines[i+1];let p=lines.find(x=>x.startsWith(label)&&x.length>label.length);return p?p.replace(label,'').trim():''};const firstImage=v=>{if(!v)return '';if(Array.isArray(v))return firstImage(v[0]);if(typeof v==='object')return v.url||v.src||v.image_url||v.imageUrl||v.thumbnail||'';return String(v)};const catPath=c=>{if(!c)return '';if(Array.isArray(c))return c.map(catPath).filter(Boolean).join(' > ');if(typeof c!=='object')return String(c);const out=[];let cur=c;let guard=0;while(cur&&typeof cur==='object'&&guard<10){if(cur.name||cur.label)out.unshift(cur.name||cur.label);cur=cur.parent_category||cur.parentCategory||cur.parent;guard++}return out.length?out.join(' > '):value(c)};const seller=first(item.seller,item.sellerInfo,item.owner,item.user,{id:item.seller_id||item.sellerId||item.sellerID,name:item.seller_name||item.sellerName});const rawStatus=value(first(item.status,item.item_status,item.itemStatus,item.trading_status,item.tradingStatus,item.availability,item.offers&&item.offers.availability));let stock='';if(/sold|sold_out|outofstock|売り切れ|売却済|売れ切り/i.test(rawStatus))stock='売れ切り';else if(/on_sale|onsale|instock|available|販売中|購入/i.test(rawStatus))stock='在庫あり';const priceRaw=value(first(item.price,item.item_price,item.itemPrice,item.sales_price,item.salesPrice,item.offers&&item.offers.price,meta('product:price:amount')));const sellerId=seller&&typeof seller==='object'?(seller.id||seller.user_id||seller.userId):'';window.__US_MERCARI_ITEM__={keyword:location.href,product_url:meta('og:url')||location.href,product_name:value(first(item.name,item.title)).trim()||((meta('og:title')||document.title).replace(/\\s*(by|-)\\s*メルカリ.*/,'').trim()),price:priceRaw?(String(priceRaw).indexOf('¥')>=0?String(priceRaw):'¥'+String(priceRaw)):'',image_url:firstImage(first(item.image,item.photos,item.photoUrls,item.photo_urls,item.images))||meta('og:image'),stock:stock,description:value(first(item.description,item.item_description,item.itemDescription,item.body)),category:catPath(first(item.item_category,item.itemCategory,item.category,item.categories,item.categoryPath))||after('カテゴリー'),brand:value(first(item.brand,item.brand_name,item.brandName,Array.isArray(item.brands)?item.brands[0]:''))||after('ブランド'),item_condition:value(first(item.item_condition,item.itemCondition,item.condition,item.item_condition_name,item.itemConditionName))||after('商品の状態'),shipping_payer:value(first(item.shipping_payer,item.shippingPayer,item.shipping_fee_payer,item.shippingFeePayer,item.shipping_payer_name,item.shippingPayerName))||after('配送料の負担'),delivery_method:value(first(item.shipping_method,item.shippingMethod,item.shipping_methods,item.shippingMethods,item.delivery_method,item.deliveryMethod))||after('配送の方法'),shipping_from_region:value(first(item.shipping_from_area,item.shippingFromArea,item.shipping_from_region,item.shippingFromRegion,item.shipping_from,item.shippingFrom))||after('発送元の地域'),shipping_duration:value(first(item.shipping_duration,item.shippingDuration,item.shipping_duration_name,item.shippingDurationName,item.shipping_period,item.shippingPeriod))||after('発送までの日数'),seller_url:sellerId?'https://jp.mercari.com/user/profile/'+sellerId:(Array.from(document.links).find(a=>/\\/user\\/profile\\//.test(a.href))||{}).href||'',seller_name:seller&&typeof seller==='object'?value(first(seller.name,seller.nickname,seller.display_name,seller.displayName,item.seller_name,item.sellerName)):value(first(item.seller_name,item.sellerName))};})();",
        "waitForCompletion": true,
        "timeout": 10,
        "color": "bg-[#a56eff]"
      }
    },
    {
      "block_id": "structured-export-1",
      "block_type": "process",
      "title": "Structured Export",
      "description": "Export Mercari product detail fields",
      "position_x": 1560,
      "position_y": 220,
      "config": {
        "rowSelector": "body",
        "fileName": "mercari_product_detail_url_scraper_cloud.csv",
        "saveLocation": "C:\\Users\\theskd\\Documents\\UScraper\\templates",
        "includeHeaders": true,
        "fileMode": "append",
        "color": "bg-[#42be65]",
        "columns": [
          {
            "name": "keyword",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.keyword)||location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_url",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.product_url)||location.href",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "product_name",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.product_name)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "price",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.price)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "image_url",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.image_url)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "stock",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.stock)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "description",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.description)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "category",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.category)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "brand",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.brand)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "item_condition",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.item_condition)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "shipping_payer",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.shipping_payer)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "delivery_method",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.delivery_method)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "shipping_from_region",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.shipping_from_region)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "shipping_duration",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.shipping_duration)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "seller_url",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.seller_url)||''",
            "attribute": "text",
            "isJs": true
          },
          {
            "name": "seller_name",
            "selector": "(window.__US_MERCARI_ITEM__&&window.__US_MERCARI_ITEM__.seller_name)||''",
            "attribute": "text",
            "isJs": true
          }
        ]
      }
    },
    {
      "block_id": "loop-continue-1",
      "block_type": "process",
      "title": "Loop Continue",
      "description": "Advance to the next Mercari product URL",
      "position_x": 1920,
      "position_y": 220,
      "config": {
        "color": "bg-[#ff832b]"
      }
    }
  ],
  "connections": [
    {
      "from_block_id": "navigate-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": "sleep-1",
      "to_connector_id": "left"
    },
    {
      "from_block_id": "sleep-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-load",
      "element_type": "group",
      "title": "Page Load",
      "color": "#08bdba",
      "position_x": 48,
      "position_y": 116,
      "width": 1040,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "navigate-1",
          "wait-for-element-1",
          "sleep-1"
        ]
      }
    },
    {
      "id": "group-interaction",
      "element_type": "group",
      "title": "Interaction",
      "color": "#a56eff",
      "position_x": 1128,
      "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": 1488,
      "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": 1848,
      "position_y": 116,
      "width": 380,
      "height": 296,
      "z_index": 20,
      "data": {
        "memberBlockIds": [
          "loop-continue-1"
        ]
      }
    },
    {
      "id": "note-overview",
      "element_type": "note",
      "title": "Overview",
      "content": "Scrapes Mercari Japan product detail pages from a provided list of product URLs. Navigation uses a multi-URL Navigate loop plus Loop Continue, so every URL in the urls array is exported into one appended CSV. This is a best-effort equivalent of the Octoparse Mercari product detail scraper; it uses embedded JSON, meta tags, and visible Japanese labels because Mercari may dynamically hydrate pages, show loading skeletons, CAPTCHA, or anti-bot blocking.",
      "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: `(function(){const meta=n=>{const el=Array.from(document.getElementsByTagName('meta')).find(e=>e.getA...` Verify in browser if results are empty.",
      "color": "#ee5396",
      "position_x": 1400,
      "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, product_url, product_name, price, image_url). These selectors are fragile — update if the site layout changes.",
      "color": "#ee5396",
      "position_x": 1760,
      "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": 2120,
      "position_y": 200,
      "width": 340,
      "height": 123,
      "z_index": 22,
      "data": {
        "block_id": "loop-continue-1"
      }
    }
  ]
}