Skip to content

Instantly share code, notes, and snippets.

@dzt
Created March 17, 2018 16:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzt/7f83e0a68f0f7f53ab48bdc4381cc08a to your computer and use it in GitHub Desktop.
Save dzt/7f83e0a68f0f7f53ab48bdc4381cc08a to your computer and use it in GitHub Desktop.
YeezySupply Variant Parsing
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>YEEZY SUPPLY</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, height=device-height, minimum-scale=1.0, user-scalable=1">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<![endif]--><!--
..
....
... ...........
..... ................
....... .....................
...............................................
.....................................................
.........................................................
...............................................................
.....................................................................
..........................................................................
.............................................................................
..............................................................................
...............................................................................
..............................................................................
....................................................................
builtbylane.com x davidbaker.tv ϟ made in brooklyn
-->
<meta name="description" content="THE OFFICIAL ONLINE STORE OF YEEZY FOOTWEAR AND APPAREL.">
<meta name="twitter:title" content="YEEZY SUPPLY">
<meta name="twitter:description" content="THE OFFICIAL ONLINE STORE OF YEEZY FOOTWEAR AND APPAREL.">
<meta name="twitter:url" content="https://yeezysupply.com/">
<meta name="twitter:image" content="https://cdn.shopify.com/s/files/1/1765/5971/files/szn-6-sharing_900x.jpg?v=1512511551">
<meta name="twitter:image:alt" content="YEEZY SUPPLY">
<meta name="twitter:card" content="summary_large_image">
<meta property="og:image" content="https://cdn.shopify.com/s/files/1/1765/5971/files/szn-6-sharing_900x.jpg?v=1512511551">
<meta property="og:title" content="YEEZY SUPPLY">
<meta property="og:description" content="THE OFFICIAL ONLINE STORE OF YEEZY FOOTWEAR AND APPAREL.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="YEEZY SUPPLY">
<meta property="og:url" content="https://yeezysupply.com/">
<link rel="apple-touch-icon" sizes="57x57" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-57x57.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="60x60" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-60x60.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="72x72" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-72x72.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="76x76" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-76x76.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="114x114" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-114x114.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="120x120" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-120x120.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="144x144" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-144x144.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="152x152" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-152x152.png?9257200055597921358">
<link rel="apple-touch-icon" sizes="180x180" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/apple-icon-180x180.png?9257200055597921358">
<link rel="icon" type="image/png" sizes="192x192" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/android-icon-192x192.png?9257200055597921358">
<link rel="icon" type="image/png" sizes="32x32" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/favicon-32x32.png?9257200055597921358">
<link rel="icon" type="image/png" sizes="96x96" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/favicon-96x96.png?9257200055597921358">
<link rel="icon" type="image/png" sizes="16x16" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/favicon-16x16.png?9257200055597921358">
<link rel="manifest" href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/manifest.json?9257200055597921358">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/ms-icon-144x144.png?9257200055597921358">
<link href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/ms-icon-144x144.png?9257200055597921358" rel="shortcut icon" sizes="16x16 32x32 64x64">
<style>
@font-face {
font-family: "VCR";
src: url("//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/VCR_OSD_MONO.eot?9257200055597921358");
src: url("//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/VCR_OSD_MONO.woff?9257200055597921358") format("woff"),
url("//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/VCR_OSD_MONO.ttf?9257200055597921358") format("truetype"),
url("//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/VCR_OSD_MONO.svg?9257200055597921358#VCR") format("svg");
font-weight: normal;
font-style: normal; }
</style>
<!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script><![endif]-->
<script>
var KANYE = KANYE || {};
KANYE.pageId = null;
</script>
<script src="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/modernizr.dynamic.build.js?9257200055597921358" type="text/javascript"></script>
<link href="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/main.css?9257200055597921358" rel="stylesheet" type="text/css" media="all" />
<meta id="shopify-digital-wallet" name="shopify-digital-wallet" content="/17655971/digital_wallets/dialog">
<meta name="shopify-checkout-api-token" content="afa13d942580749aa2985b086cc0bdcb">
<style media="all">.additional-checkout-button{border:0 !important;border-radius:5px !important;display:inline-block;margin:0 0 10px;padding:0 24px !important;max-width:100%;min-width:150px !important;line-height:44px !important;text-align:center !important}.additional-checkout-button+.additional-checkout-button{margin-left:10px}.additional-checkout-button:last-child{margin-bottom:0}.additional-checkout-button span{font-size:14px !important}.additional-checkout-button img{display:inline-block !important;height:1.3em !important;margin:0 !important;vertical-align:middle !important;width:auto !important}@media (max-width: 500px){.additional-checkout-button{display:block;margin-left:0 !important;padding:0 10px !important;width:100%}}.additional-checkout-button--apple-pay{background-color:#000 !important;color:#fff !important;display:none;font-family:-apple-system, &#39;Helvetica Neue&#39;, sans-serif !important;min-width:150px !important;white-space:nowrap !important}.additional-checkout-button--apple-pay:hover,.additional-checkout-button--apple-pay:active,.additional-checkout-button--apple-pay:visited{color:#fff !important;text-decoration:none !important}.additional-checkout-button--apple-pay .additional-checkout-button__text{display:inline-block !important;margin-right:0.5em !important}.additional-checkout-button--apple-pay .additional-checkout-button__logo{background:-webkit-named-image(apple-pay-logo-white) center center no-repeat !important;background-size:auto 100% !important;display:inline-block !important;vertical-align:middle !important;width:3em !important;height:1.3em !important}@media (max-width: 500px){.additional-checkout-button--apple-pay{display:none}}.additional-checkout-button--google-pay{line-height:0 !important;padding:0 !important;border-radius:unset !important;width:80px !important}@media (max-width: 500px){.additional-checkout-button--google-pay{width:100% !important}}.gpay-iframe{height:44px !important;width:100% !important;cursor:pointer;vertical-align:middle !important}.additional-checkout-button--paypal-express{background-color:#ffc439 !important}.additional-checkout-button--paypal{vertical-align:top;line-height:0 !important;padding:0 !important}.additional-checkout-button--amazon{background-color:#fad676 !important;position:relative !important}.additional-checkout-button--amazon .additional-checkout-button__logo{-webkit-transform:translateY(4px) !important;transform:translateY(4px) !important}.additional-checkout-button--amazon .alt-payment-list-amazon-button-image{max-height:none !important;opacity:0 !important;position:absolute !important;top:0 !important;left:0 !important;width:100% !important;height:100% !important}.additional-checkout-button-visually-hidden{border:0 !important;clip:rect(0, 0, 0, 0) !important;clip:rect(0 0 0 0) !important;width:1px !important;height:1px !important;margin:-2px !important;overflow:hidden !important;padding:0 !important;position:absolute !important}</style>
<script id="apple-pay-shop-capabilities" type="application/json">{"shopId":17655971,"countryCode":"US","currencyCode":"USD","merchantCapabilities":["supports3DS"],"merchantId":"gid:\/\/shopify\/Shop\/17655971","merchantName":"YEEZY SUPPLY","requiredBillingContactFields":["postalAddress","email","phone"],"requiredShippingContactFields":["postalAddress","email","phone"],"shippingType":"shipping","supportedNetworks":["visa","masterCard","amex","discover"],"total":{"type":"pending","label":"YEEZY SUPPLY","amount":"1.00"}}</script>
<script>var Shopify = Shopify || {};
Shopify.shop = "purchaseyzy.myshopify.com";
Shopify.theme = {"name":"2017-12-05 - F\u0026F + S6 DROP","id":351305747,"theme_store_id":null,"role":"main"};
Shopify.theme.handle = "null";
Shopify.theme.style = {"id":null,"handle":null};
</script>
<script>(function() {
function asyncLoad() {
var urls = ["https:\/\/cdn-scripts.signifyd.com\/shopify\/script-tag.js?shop=purchaseyzy.myshopify.com"];
for (var i = 0; i < urls.length; i++) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = urls[i];
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
};
if(window.attachEvent) {
window.attachEvent('onload', asyncLoad);
} else {
window.addEventListener('load', asyncLoad, false);
}
})();
</script>
<script id="__st">var __st={"a":17655971,"offset":-14400,"reqid":"eb53619b-a0dc-49fe-a65d-3ac43dfb0efc","pageurl":"yeezysupply.com\/","u":"b53c0751ca93","p":"home"};</script>
<script>window.ShopifyPaypalV4VisibilityTracking = true;</script>
<script>window.Shopify = window.Shopify || {};
window.Shopify.Checkout = window.Shopify.Checkout || {};
window.Shopify.Checkout.apiHost = "purchaseyzy.myshopify.com";
window.Shopify.Checkout.requestHost = "yeezysupply.com"
window.Shopify.Checkout.rememberMeHost = "pay.shopify.com";
window.Shopify.Checkout.rememberMeAccessToken = "NEVLY0ZVVnBsZUJmblBFTEN4TEU0UDJKcVdnUWtsU2VTeC83dmhDMWd5TzY5bmtWdU9hVGUrbGFoZW9tYXhkcC0tclNhQk04dkkzakJCY2VVUlVTMlZ1UT09--e7b43275a90261ae163d67e506b4687f393101cc";
window.Shopify.Checkout.sheetStyleSheetUrl = "\/\/cdn.shopify.com\/s\/assets\/shared\/sheet\/main-c150bd783aa9b2c6b0c41ded3880c45a0848a9914354d4222628be6c924200a3.css";
window.ShopifyPay = window.ShopifyPay || {};
window.ShopifyPay.acceleratedFlowIncontext = false;
</script>
<script>
window.ShopifyAnalytics = window.ShopifyAnalytics || {};
window.ShopifyAnalytics.meta = window.ShopifyAnalytics.meta || {};
window.ShopifyAnalytics.meta.currency = 'USD';
var meta = {"page":{"pageType":"home"}};
for (var attr in meta) {
window.ShopifyAnalytics.meta[attr] = meta[attr];
}
</script>
<script>window.ShopifyAnalytics.merchantGoogleAnalytics = function() {
};
</script>
<script class="analytics">(window.gaDevIds=window.gaDevIds||[]).push('BwiEti');
(function () {
var customDocumentWrite = function(content) {
var jquery = null;
if (window.jQuery) {
jquery = window.jQuery;
} else if (window.Checkout && window.Checkout.$) {
jquery = window.Checkout.$;
}
if (jquery) {
jquery('body').append(content);
}
};
var trekkie = window.ShopifyAnalytics.lib = window.trekkie = window.trekkie || [];
if (trekkie.integrations) {
return;
}
trekkie.methods = [
'identify',
'page',
'ready',
'track',
'trackForm',
'trackLink'
];
trekkie.factory = function(method) {
return function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(method);
trekkie.push(args);
return trekkie;
};
};
for (var i = 0; i < trekkie.methods.length; i++) {
var key = trekkie.methods[i];
trekkie[key] = trekkie.factory(key);
}
trekkie.load = function(config) {
trekkie.config = config;
var script = document.createElement('script');
script.type = 'text/javascript';
script.onerror = function(e) {
(new Image()).src = '//v.shopify.com/internal_errors/track?error=trekkie_load';
};
script.async = true;
script.src = 'https://cdn.shopify.com/s/javascripts/tricorder/trekkie.storefront.min.js?v=2017.09.05.1';
var first = document.getElementsByTagName('script')[0];
first.parentNode.insertBefore(script, first);
};
trekkie.load(
{"Trekkie":{"appName":"storefront","development":false,"defaultAttributes":{"shopId":17655971,"isMerchantRequest":null,"themeId":351305747,"themeCityHash":3442871319738387585}},"Performance":{"navigationTimingApiMeasurementsEnabled":true,"navigationTimingApiMeasurementsSampleRate":1.0},"Google Analytics":{"trackingId":"UA-3241649-58","domain":"auto","siteSpeedSampleRate":"10","enhancedEcommerce":true,"doubleClick":true,"includeSearch":true},"Facebook Pixel":{"pixelIds":["123471468322951"],"agent":"plshopify1.2"},"Session Attribution":{}}
);
var loaded = false;
trekkie.ready(function() {
if (loaded) return;
loaded = true;
window.ShopifyAnalytics.lib = window.trekkie;
ga('require', 'linker');
function addListener(element, type, callback) {
if (element.addEventListener) {
element.addEventListener(type, callback);
}
else if (element.attachEvent) {
element.attachEvent('on' + type, callback);
}
}
function decorate(event) {
event = event || window.event;
var target = event.target || event.srcElement;
if (target && (target.getAttribute('action') || target.getAttribute('href'))) {
ga(function (tracker) {
var linkerParam = tracker.get('linkerParam');
document.cookie = '_shopify_ga=' + linkerParam + '; ' + 'path=/';
});
}
}
addListener(window, 'load', function(){
for (var i=0; i < document.forms.length; i++) {
var action = document.forms[i].getAttribute('action');
if(action && action.indexOf('/cart') >= 0) {
addListener(document.forms[i], 'submit', decorate);
}
}
for (var i=0; i < document.links.length; i++) {
var href = document.links[i].getAttribute('href');
if(href && href.indexOf('/checkout') >= 0) {
addListener(document.links[i], 'click', decorate);
}
}
});
var originalDocumentWrite = document.write;
document.write = customDocumentWrite;
try { window.ShopifyAnalytics.merchantGoogleAnalytics.call(this); } catch(error) {};
document.write = originalDocumentWrite;
window.ShopifyAnalytics.lib.page(
null,
{"pageType":"home"}
);
});
var eventsListenerScript = document.createElement('script');
eventsListenerScript.async = true;
eventsListenerScript.src = "//cdn.shopify.com/s/assets/shop_events_listener-f2c5800305098f0ebebdfa7d980c9abf56514c46d5305e97a7c476f7c9116163.js";
document.getElementsByTagName('head')[0].appendChild(eventsListenerScript);
})();
</script>
<script defer="defer" integrity="sha256-3igvyAQspxPXvvCO4dejA0hpfvfOL7D6yRYWGvByptM=" crossorigin="anonymous" src="//cdn.shopify.com/s/assets/storefront/express_buttons-de282fc8042ca713d7bef08ee1d7a30348697ef7ce2fb0fac916161af072a6d3.js"></script>
<script defer="defer" src="//cdn.shopify.com/s/assets/themes_support/ga_urchin_forms-68ca1924c495cfc55dac65f4853e0c9a395387ffedc8fe58e0f2e677f95d7f23.js"></script>
<link rel="canonical" href="https://yeezysupply.com/">
</head>
<body id="page-yeezy-supply" class="page-yeezy-supply template-index js-empty-cart P__tag-">
<div class="Wrap" id="js-wrap">
<div class="Header js-header">
<div class="container">
<div class="H__menu" style="display:none;">
<div class="H__menu_main"><a class="H__link H__link-season-6" href="/collections/season-6">SEASON 6</a><a class="H__link H__link-pre-season-6" href="/collections/pre-season-6-footwear">PRE SEASON 6</a><a class="H__link H__link-season-5" href="/collections/season-5">SEASON 5</a><a class="H__link H__link-cart" href="/cart">CART</a>
</div>
<div class="H__menu_main_alt"><a class="H__link H__link-season-6" href="/collections/season-6">SEASON 6</a><a class="H__link H__link-pre-season-6" href="/collections/pre-season-6-footwear">PRE SEASON 6</a><a class="H__link H__link-season-5" href="/collections/season-5">SEASON 5</a><a class="H__link H__link-season-4" href="/collections/season-4">SEASON 4</a><a class="H__link H__link-footwear" href="/collections/season-4-footwear">FOOTWEAR </a><a class="H__link H__link-jewelry" href="/collections/jewelry">JEWELRY</a><a class="H__link H__link-help" href="/pages/help">HELP</a><a class="H__link H__link-terms" href="/pages/terms">TERMS </a><a class="H__link H__link-cart" href="/cart">CART</a>
</div>
<div class="H__menu_main_s5"><a class="H__link H__link-season-6" href="/collections/season-6">SEASON 6</a><a class="H__link H__link-pre-season-6" href="/collections/pre-season-6-footwear">PRE SEASON 6</a><a class="H__link H__link-season-5" href="/collections/season-5">SEASON 5</a><a class="H__link H__link-tops" href="/collections/season-5-tops">TOPS</a><a class="H__link H__link-outerwear" href="/collections/season-5-outerwear">OUTERWEAR</a><a class="H__link H__link-bottoms" href="/collections/season-5-bottoms">BOTTOMS</a><a class="H__link H__link-footwear" href="/collections/season-5-footwear">FOOTWEAR</a><a class="H__link H__link-bags" href="/collections/bags">BAGS</a><a class="H__link H__link-hats" href="/collections/hats">HATS</a><a class="H__link H__link-season-4" href="/collections/season-4">SEASON 4</a><a class="H__link H__link-help" href="/pages/help">HELP</a><a class="H__link H__link-terms" href="/pages/terms">TERMS</a><a class="H__link H__link-cart" href="/cart">CART</a>
</div>
</div>
</div>
</div>
<main class="B__container">
<script>
KANYE.doProduct = true;
(function() {
var p = {
id: 218855145491,
title: "YEEZY POWERPHASE CORE BLACK",
handle: "yeezy-powerphase-core-black",
vendor: "Adidas",
type: "Adidas",
available: true,
images: [],
featured_image: "\/\/cdn.shopify.com\/s\/files\/1\/1765\/5971\/products\/PP_BLACK_yeezysupply_6bea8b03-b681-4e1e-95da-07f48f8a7218.jpg?v=1521289119",
options: ["Size"],
tags: ["disable-auto-sync","one-per"],
price: 12000,
variants: [],
meta: []
};p.images.push({
src: "\/\/cdn.shopify.com\/s\/files\/1\/1765\/5971\/products\/PP_BLACK_yeezysupply_6bea8b03-b681-4e1e-95da-07f48f8a7218.jpg?v=1521289119",
alt: "YEEZY POWERPHASE CORE BLACK",
});
p.variants.push({
id: 1369945374739,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["4"],
option1: "4",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945407507,
parent_id: 218855145491,
available: false,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["4.5"],
option1: "4.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945440275,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["5"],
option1: "5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945473043,
parent_id: 218855145491,
available: false,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["5.5"],
option1: "5.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945505811,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["6"],
option1: "6",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945538579,
parent_id: 218855145491,
available: false,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["6.5"],
option1: "6.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945571347,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["7"],
option1: "7",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945604115,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["7.5"],
option1: "7.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945636883,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["8"],
option1: "8",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945669651,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["8.5"],
option1: "8.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945702419,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["9"],
option1: "9",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945735187,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["9.5"],
option1: "9.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945767955,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["10"],
option1: "10",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945800723,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["10.5"],
option1: "10.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945833491,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["11"],
option1: "11",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945866259,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["11.5"],
option1: "11.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945899027,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["12"],
option1: "12",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945931795,
parent_id: 218855145491,
available: false,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["12.5"],
option1: "12.5",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369945964563,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["13"],
option1: "13",
option2: "",
option3: "",
option4: ""
});
p.variants.push({
id: 1369946030099,
parent_id: 218855145491,
available: true,
featured_image: null,
public_title: null,
requires_shipping: true,
price: 12000,
options: ["14"],
option1: "14",
option2: "",
option3: "",
option4: ""
});
KANYE.p = KANYE.p || [];
KANYE.p.push(p);
})();
</script>
<div id="js-content" class="B__content">
<div id="P__218855145491" class="SingleProduct js-product">
<div class="container">
<div
class="Product P__type-Adidas P__handle-yeezy-powerphase-core-black P__tag-disable-auto-sync"
itemscope itemtype="http://schema.org/Product">
<input type="hidden" name="id" value="218855145491">
<div class="P__img_row js-slideshow">
<div class="js-img-cell P__img-cell P__img-cell-0"
style="background-image:url('//cdn.shopify.com/s/files/1/1765/5971/products/PP_BLACK_yeezysupply_6bea8b03-b681-4e1e-95da-07f48f8a7218_950x.jpg?v=1521289119')"
data-alt="YEEZY POWERPHASE CORE BLACK"
data-zoom-src="//cdn.shopify.com/s/files/1/1765/5971/products/PP_BLACK_yeezysupply_6bea8b03-b681-4e1e-95da-07f48f8a7218_2048x2048.jpg?v=1521289119">
<div class="P__img_bg">
<img
class="P__img js-img js-img-0"
src="//cdn.shopify.com/s/files/1/1765/5971/products/PP_BLACK_yeezysupply_6bea8b03-b681-4e1e-95da-07f48f8a7218_950x.jpg?v=1521289119"
alt="">
</div>
</div>
</div>
<div class="P__Info js-product-info js-no-desc">
<div class="PI__title js-unorphan" itemprop="name">YEEZY POWERPHASE</div>
<div class="PI__desc js-unorphan" itemprop="description">
<p>COLOR CORE BLACK <br>LIMIT ONE ITEM PER CUSTOMER <br>US AND CANADA ONLY </p>
</div>
<form action="/cart/add" class="js-product-form" method="post" enctype="multipart/form-data">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="id" class="js-id" value="1">
<div class="PI__err js-error" style="display:none"></div>
<div class="PI__wrap js-insert-select-sizes"></div>
<div class="PI__price">
<span data-price="12000" class="PI__actual_price js-price">$120</span>
</div>
<input type="submit" name="add" class="K__button" value="PURCHASE">
</form>
</div>
</div>
</div>
<div class="cf"></div>
</div>
</div>
</main>
<footer class="Footer js-footer">
<div class="container F__container">
<div class="F__menu F__menu_left">
</div>
<div class="F__menu F__menu_center">
<div class="F__menu_center_main">
<a class="F__link F__link-season-6" data-tags="" href="/collections/season-6">SEASON 6</a>
<a class="F__link F__link-pre-season-6" data-tags="" href="/collections/pre-season-6-footwear">PRE SEASON 6</a>
<a class="F__link F__link-season-5" data-tags="" href="/collections/season-5">SEASON 5</a>
<a class="F__link F__link-season-4" data-tags="" href="/collections/season-4">SEASON 4</a>
<a class="F__link F__link-help" data-tags="" href="/pages/help">HELP</a>
<a class="F__link F__link-terms" data-tags="" href="/pages/terms">TERMS</a>
<a class="F__link F__link-cart" data-tags="" href="/cart">CART</a>
</div>
<div class="F__menu_center_alt">
<a class="F__link F__link-season-6" href="/collections/season-6">SEASON 6</a>
<a class="F__link F__link-pre-season-6" href="/collections/pre-season-6-footwear">PRE SEASON 6</a>
<a class="F__link F__link-season-5" href="/collections/season-5">SEASON 5</a>
<a class="F__link F__link-season-4" href="/collections/season-4">SEASON 4</a>
<a class="F__link F__link-footwear" href="/collections/season-4-footwear">FOOTWEAR </a>
<a class="F__link F__link-jewelry" href="/collections/jewelry">JEWELRY</a>
<a class="F__link F__link-help" href="/pages/help">HELP</a>
<a class="F__link F__link-terms" href="/pages/terms">TERMS </a>
<a class="F__link F__link-cart" href="/cart">CART</a>
</div>
<div class="F__menu_center_s5">
<a class="F__link F__link-season-6" href="/collections/season-6">SEASON 6</a>
<a class="F__link F__link-pre-season-6" href="/collections/pre-season-6-footwear">PRE SEASON 6</a>
<a class="F__link F__link-season-5" href="/collections/season-5">SEASON 5</a>
<a class="F__link F__link-tops" href="/collections/season-5-tops">TOPS</a>
<a class="F__link F__link-outerwear" href="/collections/season-5-outerwear">OUTERWEAR</a>
<a class="F__link F__link-bottoms" href="/collections/season-5-bottoms">BOTTOMS</a>
<a class="F__link F__link-footwear" href="/collections/season-5-footwear">FOOTWEAR</a>
<a class="F__link F__link-bags" href="/collections/bags">BAGS</a>
<a class="F__link F__link-hats" href="/collections/hats">HATS</a>
<a class="F__link F__link-season-4" href="/collections/season-4">SEASON 4</a>
<a class="F__link F__link-help" href="/pages/help">HELP</a>
<a class="F__link F__link-terms" href="/pages/terms">TERMS</a>
<a class="F__link F__link-cart" href="/cart">CART</a>
</div>
</div>
<div class="F__menu F__menu_right">
</div>
<div class="F__menu F__menu_mobile" style="display:none">
<a class="F__link F__link-season-4" href="/collections/season-4">SEASON 4</a>
<a class="F__link F__link-help" href="/pages/help">HELP</a>
<a class="F__link F__link-terms" href="/pages/terms">TERMS</a>
</div>
<div class="F__menu F__menu_mobile_alt" style="display:none">
<a class="F__link F__link-help" href="/pages/help">HELP</a>
<a class="F__link F__link-terms" href="/pages/terms">TERMS</a>
</div>
</div>
</footer>
</div>
<script src="//cdn.shopify.com/s/files/1/1765/5971/t/10/assets/app.js?9257200055597921358" type="text/javascript"></script>
</body>
</html>
const fs = require('fs');
fs.readFile('ys.html', function(err, body) {
if (err) {
console.log(err);
}
let parsedObjects = [];
let fields = [];
let arr = body.toString().split('p.variants.push(').map(x => x.replace(");", ""))
arr.shift()
for (let i = 0 ; i < arr.length; i++) {
if (arr[i].indexOf('options') > -1) {
if (i == (arr.length - 1)) {
let obj = arr[i].split("}")[0] + "}";
let fields = fetchFields(obj);
parsedObjects.push(formatJSON(obj, fields));
} else {
let obj = arr[i];
let fields = fetchFields(obj);
parsedObjects.push(formatJSON(obj, fields));
}
}
}
console.log(parsedObjects);
});
let formatJSON = (object, fields) => {
for (let i = 0; i < fields.length; i++) {
object = object.replace(fields[i], `"${fields[i]}"`);
}
return JSON.parse(object);
}
let fetchFields = objectStr => {
objectStr.trim();
let newArr = objectStr.split(':').map( x => x.trim() );
let list = [];
for (let i = 0; i < newArr.length; i++) {
if (i != (newArr.length - 1)) {
let fieldName = newArr[i].split('\n')[newArr[i].split('\n').length - 1].replace(/ /g,'');
list.push(fieldName)
}
}
return list;
}
@shreyas-n
Copy link

❤️

@dzt
Copy link
Author

dzt commented Mar 19, 2018

@stephaneellis
Copy link

Hello. I am inexperienced in web building but am willing to create a website, which would look almost identical to yeezysupply.com
Am I allowed to use this code in any way to make this simpler and if yes what should I do next? Thanks a lot
Steph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment