Регулярка



  • {"cookies":[{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"745","minute":"22","month":"11","second":"54","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"10","day_of_week":"1","hour":"14","millisecond":"0","minute":"22","month":"2","second":"54","year":"2020"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"745","minute":"22","month":"11","second":"54","year":"2019"},"name":"_gcl_au","path":"/","secure":"0","value":"1.1.1727458877.1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"792","minute":"22","month":"11","second":"54","year":"2019"},"domain":"my.5ka.ru","expires":{"day_of_month":"13","day_of_week":"3","hour":"17","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"name":"location_id","path":"/","secure":"0","value":"1814"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"950","minute":"22","month":"11","second":"54","year":"2019"},"domain":".doubleclick.net","expires":{"day_of_month":"11","day_of_week":"4","hour":"14","millisecond":"950","minute":"22","month":"11","second":"54","year":"2021"},"has_expires":"1","httponly":"1","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"950","minute":"22","month":"11","second":"54","year":"2019"},"name":"IDE","path":"/","secure":"0","value":"AHWqTUnbWGCnnS9RiQQLKgICVXwUnVs7Cy3NCASutZvqjKkijKZPS3_Ct5SPJMru"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"11","day_of_week":"3","hour":"14","millisecond":"0","minute":"22","month":"11","second":"54","year":"2020"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"name":"_ym_uid","path":"/","secure":"0","value":"1573568575700962293"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"11","day_of_week":"3","hour":"14","millisecond":"0","minute":"22","month":"11","second":"54","year":"2020"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"name":"_ym_d","path":"/","secure":"0","value":"1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":".yandex.ru","expires":{"day_of_month":"9","day_of_week":"5","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2029"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"yandexuid","path":"/","secure":"0","value":"3520434941573568579"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":"mc.yandex.ru","expires":{"day_of_month":"0","day_of_week":"0","hour":"0","millisecond":"0","minute":"0","month":"0","second":"0","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"yabs-sid","path":"/","secure":"0","value":"439716981573568579"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":".yandex.ru","expires":{"day_of_month":"9","day_of_week":"5","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2029"},"has_expires":"1","httponly":"1","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"i","path":"/","secure":"1","value":"s4ovlY9auYpeZfYW5FJAav4acsKqEf0bygYdhCfD1FTWKBh3xb0hqFJ9X3BfxLO4yRm7ajhHkLaaMpQn+ELvDllQwGs="},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":".yandex.ru","expires":{"day_of_month":"9","day_of_week":"5","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2029"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"yp","path":"/","secure":"0","value":"1888928579.yrts.1573568579#1888928579.yrtsi.1573568579"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"11","day_of_week":"4","hour":"14","millisecond":"0","minute":"22","month":"11","second":"55","year":"2021"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"name":"_ga","path":"/","secure":"0","value":"GA1.2.999920969.1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"13","day_of_week":"3","hour":"14","millisecond":"0","minute":"22","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"name":"_gid","path":"/","secure":"0","value":"GA1.2.765200851.1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"172","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"0","minute":"23","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"172","minute":"22","month":"11","second":"55","year":"2019"},"name":"_gat_UA-77780429-1","path":"/","secure":"0","value":"1"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"187","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"13","day_of_week":"3","hour":"10","millisecond":"0","minute":"22","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"187","minute":"22","month":"11","second":"55","year":"2019"},"name":"_ym_isad","path":"/","secure":"0","value":"2"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"238","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"0","minute":"52","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"238","minute":"22","month":"11","second":"55","year":"2019"},"name":"_ym_visorc_49423435","path":"/","secure":"0","value":"w"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"0","day_of_week":"0","hour":"0","millisecond":"0","minute":"0","month":"0","second":"0","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"name":"token","path":"/","secure":"0","value":"Token116aee2220577d31ee2feadd8ea83858fd1beb8d"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"981","minute":"22","month":"11","second":"56","year":"2019"},"domain":"my.5ka.ru","expires":{"day_of_month":"0","day_of_week":"0","hour":"0","millisecond":"0","minute":"0","month":"0","second":"0","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"981","minute":"22","month":"11","second":"56","year":"2019"},"name":"header_name","path":"/","secure":"0","value":"X-Authorization"}]}
    

    Нужно вытащить от сюда ,"path":"/","secure":"0","value":" "Token116aee2220577d31ee2feadd8ea83858fd1beb8d" и :"/","secure":"0","value":" "1814"
    Чтобы я в переменной остался лишь "Token116aee2220577d31ee2feadd8ea83858fd1beb8d" и "1814"



  • @FloresRage, Выполнить код

    var json = JSON.parse([[SAVED_COOKIES]]).cookies;
    for (var i = 0; i < json.length; i++){
    if (json[i].name=="location_id"){
    [[LOCATION_ID]] = json[i].value
    break
    }};
    for (var i = 0; i < json.length; i++){
    if (json[i].name=="token"){
    [[TOKEN]] = json[i].value
    break
    }};
    


  • @FloresRage said in Регулярка:

    {"cookies":[{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"745","minute":"22","month":"11","second":"54","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"10","day_of_week":"1","hour":"14","millisecond":"0","minute":"22","month":"2","second":"54","year":"2020"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"745","minute":"22","month":"11","second":"54","year":"2019"},"name":"_gcl_au","path":"/","secure":"0","value":"1.1.1727458877.1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"792","minute":"22","month":"11","second":"54","year":"2019"},"domain":"my.5ka.ru","expires":{"day_of_month":"13","day_of_week":"3","hour":"17","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"name":"location_id","path":"/","secure":"0","value":"1814"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"950","minute":"22","month":"11","second":"54","year":"2019"},"domain":".doubleclick.net","expires":{"day_of_month":"11","day_of_week":"4","hour":"14","millisecond":"950","minute":"22","month":"11","second":"54","year":"2021"},"has_expires":"1","httponly":"1","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"950","minute":"22","month":"11","second":"54","year":"2019"},"name":"IDE","path":"/","secure":"0","value":"AHWqTUnbWGCnnS9RiQQLKgICVXwUnVs7Cy3NCASutZvqjKkijKZPS3_Ct5SPJMru"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"11","day_of_week":"3","hour":"14","millisecond":"0","minute":"22","month":"11","second":"54","year":"2020"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"name":"_ym_uid","path":"/","secure":"0","value":"1573568575700962293"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"11","day_of_week":"3","hour":"14","millisecond":"0","minute":"22","month":"11","second":"54","year":"2020"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"997","minute":"22","month":"11","second":"54","year":"2019"},"name":"_ym_d","path":"/","secure":"0","value":"1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":".yandex.ru","expires":{"day_of_month":"9","day_of_week":"5","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2029"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"yandexuid","path":"/","secure":"0","value":"3520434941573568579"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":"mc.yandex.ru","expires":{"day_of_month":"0","day_of_week":"0","hour":"0","millisecond":"0","minute":"0","month":"0","second":"0","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"yabs-sid","path":"/","secure":"0","value":"439716981573568579"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":".yandex.ru","expires":{"day_of_month":"9","day_of_week":"5","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2029"},"has_expires":"1","httponly":"1","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"i","path":"/","secure":"1","value":"s4ovlY9auYpeZfYW5FJAav4acsKqEf0bygYdhCfD1FTWKBh3xb0hqFJ9X3BfxLO4yRm7ajhHkLaaMpQn+ELvDllQwGs="},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"domain":".yandex.ru","expires":{"day_of_month":"9","day_of_week":"5","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2029"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"131","minute":"22","month":"11","second":"55","year":"2019"},"name":"yp","path":"/","secure":"0","value":"1888928579.yrts.1573568579#1888928579.yrtsi.1573568579"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"11","day_of_week":"4","hour":"14","millisecond":"0","minute":"22","month":"11","second":"55","year":"2021"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"name":"_ga","path":"/","secure":"0","value":"GA1.2.999920969.1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"13","day_of_week":"3","hour":"14","millisecond":"0","minute":"22","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"142","minute":"22","month":"11","second":"55","year":"2019"},"name":"_gid","path":"/","secure":"0","value":"GA1.2.765200851.1573568575"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"172","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"0","minute":"23","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"172","minute":"22","month":"11","second":"55","year":"2019"},"name":"_gat_UA-77780429-1","path":"/","secure":"0","value":"1"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"187","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"13","day_of_week":"3","hour":"10","millisecond":"0","minute":"22","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"187","minute":"22","month":"11","second":"55","year":"2019"},"name":"_ym_isad","path":"/","secure":"0","value":"2"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"238","minute":"22","month":"11","second":"55","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"0","minute":"52","month":"11","second":"55","year":"2019"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"238","minute":"22","month":"11","second":"55","year":"2019"},"name":"_ym_visorc_49423435","path":"/","secure":"0","value":"w"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"domain":".5ka.ru","expires":{"day_of_month":"0","day_of_week":"0","hour":"0","millisecond":"0","minute":"0","month":"0","second":"0","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"979","minute":"22","month":"11","second":"56","year":"2019"},"name":"token","path":"/","secure":"0","value":"Token116aee2220577d31ee2feadd8ea83858fd1beb8d"},{"creation":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"981","minute":"22","month":"11","second":"56","year":"2019"},"domain":"my.5ka.ru","expires":{"day_of_month":"0","day_of_week":"0","hour":"0","millisecond":"0","minute":"0","month":"0","second":"0","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"12","day_of_week":"2","hour":"14","millisecond":"981","minute":"22","month":"11","second":"56","year":"2019"},"name":"header_name","path":"/","secure":"0","value":"X-Authorization"}]}
    

    Нужно вытащить от сюда ,"path":"/","secure":"0","value":" "Token116aee2220577d31ee2feadd8ea83858fd1beb8d" и :"/","secure":"0","value":" "1814"
    Чтобы я в переменной остался лишь "Token116aee2220577d31ee2feadd8ea83858fd1beb8d" и "1814"

    [[TOKEN]] = JSON.parse([[SAVED_COOKIES]])["cookies"].filter(function(c){return c["name"] == "token"})[0]["value"]
    [[LOCATION_ID]] = JSON.parse([[SAVED_COOKIES]])["cookies"].filter(function(c){return c["name"] == "location_id"})[0]["value"]
    

    или

    var json = JSON.parse([[SAVED_COOKIES]])["cookies"]
    [[TOKEN]] = json.filter(function(c){return c["name"] == "token"})[0]["value"]
    [[LOCATION_ID]] = json.filter(function(c){return c["name"] == "location_id"})[0]["value"]
    

Log in to reply