So I am trying to scrape some data from a website. And I am trying to get it's availability date which is in a section starting with //#835635. Currently, I have the HTML content of this section stripped out from the website and have a string payload like this.
//#835635
var chn_capture_status = "OFF";
var qSVariables = "";
var siteSubDirectory = "/us";
var siteUseCase = "jellycat-us";
var groupUseCase = "DEFAULT";
var currencyUseCase = "USD";
var cc_module = false;
var startTime = new Date().getTime();
var prodzoom_control = 'on';
var globalPageCookieName = 'PageJellycat2';
var siteid = 'jellycat-us'
//alert('jellycat-us')
var google_recaptcha_site_key = '6Ldj1SAUAAAAACV-v_0I26uqFnr8Az2jrC2GEYw_';
var stock_notify_status = '0';
var stock_notify_threshold = 0;
$(document).ready(function () {
$('#zoomArea').fancybox();
saveRecentlyViewed('BARM3BR', 'Bartholomew Bear', '/bartholomew-bear-barm3br/', 'BARM3BR.jpg');
saveLastProductToCookie('BARM3BR')
});
var buy_button_hidden_instock = 'In stock - Contact us to order this item.';
var buy_button_hidden_outstock = 'OUT OF STOCK <br />Contact us to find out when this item will be next available.';
$(document).ready(function () {
var myVariantGridEM = new variantGrid('myVariantGridEM'); // Load the variant grid class
variants = {
"barh2br": {
'sequence': '27',
'wasprice': '$40.00 USD',
'wasprice_net': '$40.00 USD',
'price': '$40.00 USD',
'price_net': '$40.00 USD',
'sale_item': 'false',
'manufacturer_sku': '',
'manufacturer_name': 'JELLYCAT',
'sell': 'false',
'stock_level': -1,
'lead_text': '2020-12-16',
'lead_text_summary': 'Returning to stock 3-4 weeks',
'show_certificate': 'N',
'cc_available': 'true',
'option1': 'BROWN',
'option2': 'HUGE - H19\"',
'option3': '',
'pf_id': 'BARM3BR',
'monogram_code': '',
'tailoring_code': '',
'promo_flag': '',
'swatch': 'BARM3BR.jpg',
'swatchhex': '',
'attributes': {
"animal": ["Bear"],
"style": ["Bartholomew"]
},
'downloads': {},
'name': 'Bartholomew Bear',
'branddesc': '',
'pers_max_length': 0,
'pers_colors': '',
'pers_fonts': '',
'pers_positions': '',
'pers_help': '',
'pers_cost': 0,
'pers_cost_to_show': '$0.00 USD',
'images': ['BARH2BR.jpg'],
'sku': 'BARH2BR'
},
"barl2br": {
'sequence': '35',
'wasprice': '$30.00 USD',
'wasprice_net': '$30.00 USD',
'price': '$30.00 USD',
'price_net': '$30.00 USD',
'sale_item': 'false',
'manufacturer_sku': '',
'manufacturer_name': 'JELLYCAT',
'sell': 'false',
'stock_level': -2,
'lead_text': '2020-12-11',
'lead_text_summary': 'Returning to stock 3-4 weeks',
'show_certificate': 'N',
'cc_available': 'true',
'option1': 'BROWN',
'option2': 'LARGE - H14\"',
'option3': '',
'pf_id': 'BARM3BR',
'monogram_code': '',
'tailoring_code': '',
'promo_flag': '',
'swatch': 'BARM3BR.jpg',
'swatchhex': '',
'attributes': {
"animal": ["Bear"],
"style": ["Bartholomew"]
},
'downloads': {},
'name': 'Bartholomew Bear',
'branddesc': '',
'pers_max_length': 0,
'pers_colors': '',
'pers_fonts': '',
'pers_positions': '',
'pers_help': '',
'pers_cost': 0,
'pers_cost_to_show': '$0.00 USD',
'images': ['BARL2BR.jpg'],
'sku': 'BARL2BR'
},
"barm3br": {
'sequence': '50',
'wasprice': '$22.50 USD',
'wasprice_net': '$22.50 USD',
'price': '$22.50 USD',
'price_net': '$22.50 USD',
'sale_item': 'false',
'manufacturer_sku': '',
'manufacturer_name': 'JELLYCAT',
'sell': 'false',
'stock_level': -6,
'lead_text': '2021-02-09',
'lead_text_summary': 'Returning to stock 2-3 months',
'show_certificate': 'N',
'cc_available': 'true',
'option1': 'BROWN',
'option2': 'MEDIUM - H11\"',
'option3': '',
'pf_id': 'BARM3BR',
'monogram_code': '',
'tailoring_code': '',
'promo_flag': '',
'swatch': 'BARM3BR.jpg',
'swatchhex': '',
'attributes': {
"animal": ["Bear"],
"style": ["Bartholomew"]
},
'downloads': {},
'name': 'Bartholomew Bear',
'branddesc': '',
'pers_max_length': 0,
'pers_colors': '',
'pers_fonts': '',
'pers_positions': '',
'pers_help': '',
'pers_cost': 0,
'pers_cost_to_show': '$0.00 USD',
'images': [],
'sku': 'BARM3BR'
}
}
settings = {
"option1": "Please select an option.",
"option1_alert": "Please select an option from the dropdown",
"option2": "Please select an option.",
"option2_alert": "Please select an option from the dropdown",
"vat_text": "Inc VAT",
"includes_vat": "1",
"hidebasketbutton": "0",
"variantarea": "variant-grid-area",
"image": "mainImage",
"spinseturl": "SPINSET_URL_HTTPS",
"defaultsku": "barm3br",
"pagetype": "",
"alternatives": {
"BARM3BR": {
"image": ["BARM3BR.jpg", "BARM3BR_1.jpg", "BARM3BR_2.jpg", "BARM3BR_3.jpg"]
}
},
mappings: {
"price": "Price (Inc VAT)",
"animal": "Animal",
"author": "Authors",
"blog_categories": "Categories (Blog)",
"brand": "Brand",
"category_list": "Categories",
"date": "Archive",
"rss": "RSS",
"size": "Size",
"style": "Style",
"tags": "Tags"
},
show_price: "true",
option1: "Please select an option."
}
myVariantGridEM.loadVariants(variants);
myVariantGridEM.loadSettings(settings);
myVariantGridEM.renderGrid();
});
var level2cat = 'COLLECTIONS';
var level3cat = '';
$(document).ready(function () {
cdnPull_Function();
});
function cdnPull_Function() {
cdnPull('CurrentCustomerJellycat2', true);
cdnPullPage('PageJellycat2', 'product');
}
< / script >
< script type = "text/javascript" >
var renderCallBack = function () {
var recaptcha1;
if ($('#recaptcha1').length == 1) {
recaptcha1 = grecaptcha.render('recaptcha1', {
'sitekey': google_recaptcha_site_key, //Replace this with your Site key
'theme': 'light'
});
}
};
And I would like to somehow format the string into an object so I can extract more detailed data from it.