Используйте re.search
для извлечения строки и для сохранения многострочной строки внутри переменной, вы должны использовать тройные кавычки.
s = '''[\\"email\\",\\"fbclid\\",\\"gclid\\",\\"cpc\\"],\\"affiliateDisable\\":false,\\"affiliateCookieLifetime\\":30},\\"checkoutSettings\\":{\\"showVoucherCodeOption\\":true,\\"partialDeliveryAmountFee\\":99,\\"partialDeliveryCheckboxText\\":\\"Ja takk, jeg vil at ordren delleveres\\",\\"partialDeliveryEnabled\\":true,\\"partialDeliveryHeading\\":\\"Psst! Handlekurven inneholder varer som ikke er p\\u00E5 lager\\"},\\"trackingSettings\\":{\\"adFormSecondaryId\\":0,\\"adFormId\\":0,\\"googleTagManagerCode\\":\\"GTM-TZ5VT4C\\"},\\"hostname\\":\\"www.hifiklubben.no\\",\\"bffUrl\\":\\"\\"}";window.cacheTimestamp="637260912365759806";\n /*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License - https://github.com/filamentgroup/loadCSS */\n !function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){function e(){t.media=a}var a=t.media||"all";t.addEventListener?t.addEventListener("load",e):t.attachEvent&&t.attachEvent("onload",e),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(e,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);']'''
match = re.search(r'''window.cacheTimestamp=["'](\d+)['"]''', s)
if match: print(match.group(1))