Created
August 5, 2019 10:37
-
-
Save panoply/17749993bd27b54acad42cce6cfab976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PARSE SHOPIFY SECTION | |
*/ | |
const regex = /(?<=application\/json">\n?)({|\[)([\s\S]+?)(?=<\/)/g | |
m.request({ | |
url: '/?section_id=1564432230347', | |
extract: function (xhr) { | |
return { | |
status: xhr.status, | |
body: xhr.responseText | |
} | |
} | |
}) | |
.then(function (response) { | |
const match = response.body.match(regex) | |
console.log(JSON.parse(match[0])) | |
}).catch(e => console.log(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment