Парсинг куков



  • Помогите спарсить значения value для sessionid и steamCountry домена .steamcommunity.com

    {
        "cookies": [
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".steamcommunity.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "sessionid",
                "path": "/",
                "secure": "1",
                "value": "2b01375565e44cf4b60b362e"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".steamcommunity.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "steamCountry",
                "path": "/",
                "secure": "1",
                "value": "RU%7C96115adcd2014da2c7b0a07949ddcf9b"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".store.steampowered.com",
                "expires": {
                    "day_of_month": "18",
                    "day_of_week": "6",
                    "hour": "14",
                    "millisecond": "0",
                    "minute": "13",
                    "month": "7",
                    "second": "10",
                    "year": "2020"
                },
                "has_expires": "1",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "browserid",
                "path": "/",
                "secure": "1",
                "value": "1246852229602432714"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".store.steampowered.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "steamCountry",
                "path": "/",
                "secure": "1",
                "value": "RU%7C96115adcd2014da2c7b0a07949ddcf9b"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".store.steampowered.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "sessionid",
                "path": "/",
                "secure": "1",
                "value": "17c63d79bbe4a90062df9677"
            }
        ]
    }
    


  • @jest said in Парсинг куков:

    Помогите спарсить значения value для sessionid и steamCountry домена .steamcommunity.com

    {
        "cookies": [
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".steamcommunity.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "sessionid",
                "path": "/",
                "secure": "1",
                "value": "2b01375565e44cf4b60b362e"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".steamcommunity.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "steamCountry",
                "path": "/",
                "secure": "1",
                "value": "RU%7C96115adcd2014da2c7b0a07949ddcf9b"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".store.steampowered.com",
                "expires": {
                    "day_of_month": "18",
                    "day_of_week": "6",
                    "hour": "14",
                    "millisecond": "0",
                    "minute": "13",
                    "month": "7",
                    "second": "10",
                    "year": "2020"
                },
                "has_expires": "1",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "browserid",
                "path": "/",
                "secure": "1",
                "value": "1246852229602432714"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".store.steampowered.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "steamCountry",
                "path": "/",
                "secure": "1",
                "value": "RU%7C96115adcd2014da2c7b0a07949ddcf9b"
            },
            {
                "creation": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "domain": ".store.steampowered.com",
                "expires": {
                    "day_of_month": "0",
                    "day_of_week": "0",
                    "hour": "-1",
                    "millisecond": "0",
                    "minute": "-1",
                    "month": "0",
                    "second": "-1",
                    "year": "0"
                },
                "has_expires": "0",
                "httponly": "0",
                "last_access": {
                    "day_of_month": "1",
                    "day_of_week": "5",
                    "hour": "0",
                    "millisecond": "0",
                    "minute": "0",
                    "month": "1",
                    "second": "0",
                    "year": "2010"
                },
                "name": "sessionid",
                "path": "/",
                "secure": "1",
                "value": "17c63d79bbe4a90062df9677"
            }
        ]
    }
    

    В выполнить код

    [[SAVED_COOKIES]] = '{"cookies":[{"creation":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"domain":".steamcommunity.com","expires":{"day_of_month":"0","day_of_week":"0","hour":"-1","millisecond":"0","minute":"-1","month":"0","second":"-1","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"name":"sessionid","path":"/","secure":"1","value":"2b01375565e44cf4b60b362e"},{"creation":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"domain":".steamcommunity.com","expires":{"day_of_month":"0","day_of_week":"0","hour":"-1","millisecond":"0","minute":"-1","month":"0","second":"-1","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"name":"steamCountry","path":"/","secure":"1","value":"RU%7C96115adcd2014da2c7b0a07949ddcf9b"},{"creation":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"domain":".store.steampowered.com","expires":{"day_of_month":"18","day_of_week":"6","hour":"14","millisecond":"0","minute":"13","month":"7","second":"10","year":"2020"},"has_expires":"1","httponly":"0","last_access":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"name":"browserid","path":"/","secure":"1","value":"1246852229602432714"},{"creation":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"domain":".store.steampowered.com","expires":{"day_of_month":"0","day_of_week":"0","hour":"-1","millisecond":"0","minute":"-1","month":"0","second":"-1","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"name":"steamCountry","path":"/","secure":"1","value":"RU%7C96115adcd2014da2c7b0a07949ddcf9b"},{"creation":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"domain":".store.steampowered.com","expires":{"day_of_month":"0","day_of_week":"0","hour":"-1","millisecond":"0","minute":"-1","month":"0","second":"-1","year":"0"},"has_expires":"0","httponly":"0","last_access":{"day_of_month":"1","day_of_week":"5","hour":"0","millisecond":"0","minute":"0","month":"1","second":"0","year":"2010"},"name":"sessionid","path":"/","secure":"1","value":"17c63d79bbe4a90062df9677"}]}'
    
    var json = JSON.parse([[SAVED_COOKIES]])
    for (var i = 0; i < json.cookies.length; i++){
    if (json.cookies[i].name == "steamCountry" && json.cookies[i].domain == ".steamcommunity.com"){
    [[VALUE]] = json.cookies[i].value
    }
    if (json.cookies[i].name == "sessionid" && json.cookies[i].domain == ".steamcommunity.com"){
    [[VALUE2]] = json.cookies[i].value
    }}
    


  • @uraabk Спасибо большое!


Log in to reply
 

  • 4
  • 18
  • 4
  • 2
  • 13
  • 3
  • 2
  • 9