Untitled

 avatar
unknown
plain_text
3 years ago
26 kB
3
Indexable
{
  "sectionSelector": "body",
  "variantsExtractor": {
    "oneVariantPerUrl": true,
    "JSONUrlOptions": {
      "pathname": {},
      "useRawUrl": false
    },
    "strategy": "shopify",
    "perVariantFns": []
  },
  "postProcessFns": [
    {
      "fnName": "assureMainDescription",
      "fnParams": {
        "headerKeys": [
          "Description"
        ]
      }
    },
    {
      "fnName": "generateDescriptionFromMainDescription",
      "fnParams": {}
    },
    {
      "fnName": "extractBulletsFromAdditionalSections",
      "fnParams": {
        "maxLength": 1000,
        "disabled": false
      }
    },
    {
      "fnName": "extractVideosFromAdditionalSections",
      "fnParams": {
        "disabled": false
      }
    },
    {
      "fnName": "extractKeyValuePairsFromAdditionalSections",
      "fnParams": {
        "filterKeys": [
          "https",
          "Best For",
          "Washability"
        ],
        "maxLength": 1000
      }
    },
    {
      "fnName": "populateSizeAndColor",
      "fnParams": {
        "colorKeys": [
          "color",
          "Color"
        ],
        "sizeKeys": [
          "Size",
          "size",
          "Size (Men's)",
          "TITLE"
        ]
      }
    },
    {
      "fnName": "deduplicateVideos",
      "fnParams": {}
    },
    {
      "fnName": "normalizeProduct",
      "fnParams": {}
    },
    {
      "fnParams": {
        "fnCode": async product => {
  let filtersForImgs = ['icon', 'pantone', 'oil_womens_addeda2b', 'width', 'files/pomade-2', 'pop-up', 'hq-rm', 'swatch', 'no_shine', 'wavy_mens']
  product.images = product.images.filter(img => {
      let keepImg = true
      filtersForImgs.forEach(filter => {
          if(img.includes(filter) || img.includes('+180w')){
             keepImg = false
          }
      })
      return keepImg
  })
},
        "disabled": true
      },
      "fnName": "customFunction"
    },
    {
      "fnParams": {},
      "fnName": "deduplicateImages"
    }
  ],
  "preProcessFns": [],
  "navigationOptions": {
    "waitUntil": "networkidle0",
    "disableWaitUntil": false,
    "useJquery": true,
    "clearExtraHeaders": false,
    "disableWebSecurity": false,
    "timeout": 300000
  },
  "postNavigateFns": [
    {
      "fnName": "checkNotFound",
      "fnParams": {
        "strategy": "statusCode",
        "statusCodes": [
          404
        ]
      }
    },
    {
      "fnParams": {
        "time": 2000
      },
      "fnName": "waitForTimeout"
    },
    {
      "fnParams": {},
      "fnName": "autoScroll"
    },
    {
      "fnParams": {
        "time": 4000
      },
      "fnName": "waitForTimeout"
    },
    {
      "fnParams": {
        "selector": "#FeatureRowImage-popup"
      },
      "fnName": "deleteElements"
    },
    {
      "fnParams": {
        "selector": "[class=\"product-single__description rte\"][style=\"display: none;\"]"
      },
      "fnName": "deleteElements"
    },
    {
      "fnParams": {
        "selector": ".build-regimen-products"
      },
      "fnName": "deleteElements"
    },
    {
      "fnParams": {
        "selector": "#FeatureRowImage-3"
      },
      "fnName": "deleteElements"
    }
  ],
  "propertiesExtractors": {
    "url": [
      {
        "extractorType": "text",
        "extractorParams": {
          "strategy": "pageData",
          "path": "url"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "id": [
      {
        "extractorType": "text",
        "extractorParams": {
          "strategy": "shopifyText",
          "path": "variantData.id"
        },
        "validation": {
          "mandatory": true
        }
      }
    ],
    "itemGroupId": [
      {
        "extractorType": "text",
        "extractorParams": {
          "strategy": "shopifyText",
          "path": "id"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "sku": [
      {
        "extractorType": "text",
        "extractorParams": {
          "strategy": "shopifyText",
          "path": "variantData.sku"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "realPrice": [
      {
        "extractorType": "number",
        "extractorParams": {
          "strategy": "shopifyNumber",
          "path": "calculatedData.realPrice"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "higherPrice": [
      {
        "extractorType": "number",
        "extractorParams": {
          "strategy": "shopifyNumber",
          "path": "calculatedData.higherPrice"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "currency": [
      {
        "extractorType": "staticValue",
        "extractorParams": {
          "strategy": "default",
          "value": "USD"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "availability": [
      {
        "extractorType": "boolean",
        "extractorParams": {
          "strategy": "shopifyBoolean",
          "path": "variantData.available"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "video": [
      {
        "extractorType": "videos",
        "extractorParams": {
          "strategy": "shopify",
          "deduplicate": false,
          "normalize": false,
          "removeQueryStrings": false,
          "includeVideosWithoutExtension": true,
          "removeRegexValidation": false,
          "includeFormatsInRegex": [
            "mp4"
          ]
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "image": [
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "selectorAttribute",
          "placement": "main",
          "deduplicate": false,
          "normalize": false,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "selector": "  .grid.product-single:nth(0) .grid__item .product-single__media-wrapper:not(.hide) img",
          "attribute": "currentSrc",
          "normalizeShopify": false,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "selectorAttribute",
          "postProcess": [
            {
              "fnParams": {
                "match": "_110x110@2x",
                "replaceAll": true,
                "ignoreCase": true,
                "disabled": false
              },
              "fnName": "regexMatchReplace"
            }
          ],
          "placement": "main",
          "deduplicate": false,
          "normalize": true,
          "removeQueryStrings": true,
          "removeRegexValidation": true,
          "selector": ".main-product .thumbnails-wrapper .product-single__thumbnail img ",
          "attribute": "currentSrc",
          "normalizeShopify": false,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "selectorAttribute",
          "postProcess": [
            {
              "fnParams": {
                "match": "_([0-9]+)x\\.",
                "replace": ".",
                "replaceAll": true,
                "ignoreCase": true
              },
              "fnName": "regexMatchReplace"
            }
          ],
          "placement": "main",
          "deduplicate": true,
          "normalize": true,
          "removeQueryStrings": true,
          "removeRegexValidation": false,
          "selector": "  .grid.product-single:nth(0) .grid__item .product-single__media-wrapper img",
          "attribute": "currentSrc",
          "normalizeShopify": false,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "imgElements",
          "postProcess": [],
          "placement": "secondary",
          "deduplicate": true,
          "normalize": true,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "baseElementSelector": ".feature-row-image-w-text",
          "imgElementsSelector": ".feature-row-image-w-text img:not([alt*=\"Tip:\"]):not([alt*=\"logo\"]):not(.logo)img:not([alt*=\"Tip:\"]):not([alt*=\"logo\"]):not(.logo)",
          "imgAttributes": [
            "currentSrc",
            "src"
          ],
          "filterHidden": true,
          "normalizeShopify": true,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "imgElements",
          "postProcess": [],
          "placement": "secondary",
          "deduplicate": true,
          "normalize": true,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "baseElementSelector": ".product-feature-row-image-w-list",
          "imgElementsSelector": ".product-feature-row-image-w-list img:not([alt*=\"Tip:\"]):not([alt*=\"logo\"]):not(.logo)img:not([alt*=\"Tip:\"]):not([alt*=\"logo\"]):not(.logo)",
          "imgAttributes": [
            "currentSrc",
            "src"
          ],
          "filterHidden": true,
          "normalizeShopify": true,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "imgElements",
          "postProcess": [],
          "placement": "secondary",
          "deduplicate": true,
          "normalize": true,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "imgElementsSelector": "img[id*=FeatureRowImage]:not([alt*=featuring])",
          "imgAttributes": [
            "currentSrc",
            "src"
          ],
          "filterHidden": true,
          "normalizeShopify": false,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "selectorAttribute",
          "placement": "secondary",
          "deduplicate": false,
          "normalize": true,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "selector": "#shopify-section-kit-includes img",
          "attribute": "src",
          "normalizeShopify": false,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "selectorAttribute",
          "placement": "secondary",
          "deduplicate": false,
          "normalize": true,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "selector": ".product-single__description.rte .responsive-img",
          "attribute": "src",
          "normalizeShopify": false,
          "minHeight": 500,
          "minWidth": 500,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "selectorAttribute",
          "postProcess": [
            {
              "fnParams": {
                "fnCode": images => {
    if (images[0] == null){
        return []
    } else {
        var i = 0
        images.forEach(x => {
            images[i] = images[i].match(/(\/\/cdn)([\S]+)(\.(jpg|png|gif|jpeg|JPG|heic))/g)[0]
            images[i] = "https:" + images[i]
            var resolution = images[i].match(/_([0-9]+)x(?=\.(jpg|png|gif|jpeg|JPG|heic))/g)
            if (resolution !==null){
              images[i] = images[i].replace(/_([0-9]+)x(?=\.(jpg|png|gif|jpeg|JPG|heic))/g, "")
            }
            i++
        })
        return images
    }
}
              },
              "fnName": "customFunction"
            }
          ],
          "placement": "secondary",
          "deduplicate": false,
          "normalize": true,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "selector": ".looks-carousel img",
          "attribute": "data-srcset",
          "normalizeShopify": false,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "images",
        "extractorParams": {
          "strategy": "selectorAttribute",
          "postProcess": [
            {
              "fnParams": {
                "fnCode": images => {
    if (images[0] == null){
        return []
    } else {
        var i = 0
        images.forEach(x => {
            images[i] = images[i].match(/(\/\/cdn)([\S]+)(\.(jpg|png|gif|jpeg|JPG|heic))/g)[0]
            images[i] = "https:" + images[i]
            var resolution = images[i].match(/_([0-9]+)x(?=\.(jpg|png|gif|jpeg|JPG|heic))/g)
            if (resolution !==null){
              images[i] = images[i].replace(/_([0-9]+)x(?=\.(jpg|png|gif|jpeg|JPG|heic))/g, "")
            }
            i++
        })
        return images
    }
}
              },
              "fnName": "customFunction"
            }
          ],
          "placement": "secondary",
          "deduplicate": false,
          "normalize": true,
          "removeQueryStrings": false,
          "removeRegexValidation": false,
          "selector": "[data-section-type=\"hero-section\"] .hero picture source",
          "attribute": "data-srcset",
          "normalizeShopify": false,
          "includeImagesWithoutExtension": false,
          "includeFormatsInRegex": [
            "jpg",
            "jpeg",
            "png",
            "gif",
            "webp"
          ]
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "title": [
      {
        "extractorType": "text",
        "extractorParams": {
          "strategy": "selectorTextContent",
          "selector": ".product-single__title",
          "unique": true,
          "joinCharacter": " "
        },
        "validation": {
          "mandatory": true
        }
      }
    ],
    "brand": [
      {
        "extractorType": "text",
        "extractorParams": {
          "strategy": "customData",
          "path": "vendor"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "additionalSection": [
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "postProcess": [],
          "contentSelector": ".product-single__description:has(.full-description) .full-description:contains(a) , .product-single__description:not(:has(.full-description)):contains(a) , .product-single__description:not(:has(.full-description)):contains(e)",
          "contentSelectorUnique": true,
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.MAIN
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "contentSelector": ".shopify-section.product-featurerow--image-w-text",
          "contentSelectorUnique": false,
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.MAIN
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "contentSelector": "[class=\"feature-row__item feature-row__text feature-row__text--right\"] [class=\"rte rte-setting featured-row__subtext\"]",
          "contentSelectorUnique": false,
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.MAIN
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "contentSelector": ".feature-row__text--left .rte.rte-setting.featured-row__subtext",
          "contentSelectorUnique": false,
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.ADJACENT
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "contentSelector": ".kit-includes",
          "contentSelectorUnique": true,
          "headerSelector": ".kit-includes h3",
          "headerSelectorUnique": true,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.ADJACENT
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "postProcess": [
            {
              "fnParams": {
                "fnCode": async (data, { input, config }, { _, Errors }) => {
                  if (!data[0]) return []

                  let content = await input.page.evaluate(() => {
                    let description = document.querySelector('.pomade-compare')

                    let content = Array.from(description.querySelectorAll('.flex-row')).map(infoRow => {
                      let newInfoRow = infoRow.innerHTML
                      newInfoRow = newInfoRow?.replaceAll(/<\/div>/g, '</span>')
                      newInfoRow = newInfoRow?.replaceAll(/<div [a-zA-Z="\s-]*>/g, '<span>')
                      newInfoRow += '<br>'
                      return newInfoRow
                    })
                    content = '<br>' + content.reduce((prv, curr) => prv + `${curr}`, ``)
                    return content
                  })
                  data[0].content = content
                  return data
                }
              },
              "fnName": "customFunction"
            }
          ],
          "contentSelector": ".pomade-compare",
          "contentSelectorUnique": true,
          "headerSelector": ".pomade-compare .h3",
          "headerSelectorUnique": true,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.ADJACENT
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "preProcess": [
            {
              "fnParams": {
                "waitBetweenClicks": 1000,
                "selectors": [
                  ".features-tab"
                ]
              },
              "fnName": "clicker"
            }
          ],
          "contentSelector": ".features-content",
          "contentSelectorUnique": false,
          "headerSelector": ".features-tab",
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.MAIN
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "contentSelector": ".product-feature-row-how-to",
          "contentSelectorUnique": false,
          "headerSelector": ".product-feature-row-how-to .h3",
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.ADJACENT
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "contentSelector": ".description-content .description-text.product-single__description.rte",
          "contentSelectorUnique": false,
          "headerSelector": " div.description-tab.btn-tabs h3",
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.ADJACENT
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "additionalSections",
        "extractorParams": {
          "strategy": "selector",
          "contentSelector": "[class=\"page-width product-feature-row-images-w-video\"]:contains(\"How To Use\")",
          "contentSelectorUnique": true,
          "headerSelectorUnique": false,
          "descriptionPlacement": DESCRIPTION_PLACEMENT.ADJACENT
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "option": [
      {
        "extractorType": "options",
        "extractorParams": {
          "strategy": "shopify",
          "postProcess": [
            {
              "fnParams": {
                "fnCode": (data, {input, config}, {_, Errors}) => {
  if(!data) return;
  if(data["Title"] && data["Title"].includes('Default')){
    delete data["Title"]
  }
  return data
}
              },
              "fnName": "customFunction"
            }
          ]
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "sizeChartHtml": [
      {
        "extractorType": "text",
        "extractorParams": {
          "strategy": "selectorOuterHtml",
          "selector": "#apparelSizeChart",
          "unique": true,
          "joinCharacter": " "
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "bullet": [
      {
        "extractorType": "bullets",
        "extractorParams": {
          "strategy": "selectorTextContent",
          "selector": ".item.title-container"
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "bullets",
        "extractorParams": {
          "strategy": "selectorTextContent",
          "selector": ".item.features-container ul li"
        },
        "validation": {
          "mandatory": false
        }
      },
      {
        "extractorType": "bullets",
        "extractorParams": {
          "strategy": "selectorTextContent",
          "selector": ".variant-profile"
        },
        "validation": {
          "mandatory": false
        }
      }
    ],
    "relatedProduct": [
      {
        "extractorType": "relatedProducts",
        "extractorParams": {
          "strategy": "selector",
          "baseSelector": ".cbb-frequently-bought-products",
          "urlSelector": {
            "selector": "a",
            "attribute": "data-href"
          },
          "variantIdSelector": {},
          "itemGroupIdSelector": {},
          "deduplicate": true,
          "removeQuery": false,
          "forcePageOrigin": false
        },
        "validation": {}
      }
    ]
  }
}
Editor is loading...