N
N
newdancer2018-03-21 20:03:03
PHP
newdancer, 2018-03-21 20:03:03

How to parse script data with phpQuery?

How to parse script data with phpQuery?
The page has a script inside it has a function with the values ​​​​to be obtained. Script example

function InitRatings()
{
    

    $(".ajax_rating.await_rating").each(function(){
        var id = parseInt($(this).data("film-id"));
        ids += id + "|";
    });

    $.post('/handler_get_parameter.php', {where: ids, token: xsrftoken}, function (data, status) {
        eval(data);
    });

    if (typeof(ur_data) == 'undefined') {ur_data = [];}
               ur_data.push({film: 1111749, rating: "", user_code: ""}); 
               ur_data.push({film: 409171, rating: "", user_code: ""}); 
               ur_data.push({film: 1100779, rating: "", user_code: ""}); 
               ur_data.push({film: 972321, rating: "", user_code: ""}); 
               ur_data.push({film: 1044592, rating: "", user_code: ""}); 
               ur_data.push({film: 794620, rating: "", user_code: ""}); 
               ur_data.push({film: 809570, rating: "", user_code: ""}); 
               ur_data.push({film: 987190, rating: "", user_code: ""}); 
               ur_data.push({film: 1103876, rating: "", user_code: ""}); 
               ur_data.push({film: 867331, rating: "", user_code: ""}); 
               ur_data.push({film: 1048346, rating: "", user_code: ""}); 
               ur_data.push({film: 1112643, rating: "", user_code: ""}); 
               ur_data.push({film: 930555, rating: "", user_code: ""}); 
               ur_data.push({film: 1047736, rating: "", user_code: ""}); 
               ur_data.push({film: 1044906, rating: "", user_code: ""}); 
               ur_data.push({film: 979129, rating: "", user_code: ""}); 
               ur_data.push({film: 1022462, rating: "", user_code: ""}); 
               ur_data.push({film: 799482, rating: "", user_code: ""}); 
               ur_data.push({film: 1006294, rating: "", user_code: ""}); 
               ur_data.push({film: 1045076, rating: "", user_code: ""}); 
               ur_data.push({film: 1111744, rating: "", user_code: ""}); 
               ur_data.push({film: 1108575, rating: "", user_code: ""}); 
               ur_data.push({film: 981230, rating: "", user_code: ""}); 
               ur_data.push({film: 666865, rating: "", user_code: ""}); 
               ur_data.push({film: 1047724, rating: "", user_code: ""}); 
               ur_data.push({film: 958501, rating: "", user_code: ""}); 
               ur_data.push({film: 924167, rating: "", user_code: ""}); 
               ur_data.push({film: 1103852, rating: "", user_code: ""}); 
               ur_data.push({film: 1082597, rating: "", user_code: ""}); 
               ur_data.push({film: 1107025, rating: "", user_code: ""}); 
               ur_data.push({film: 1075751, rating: "", user_code: ""}); 
               ur_data.push({film: 1062316, rating: "", user_code: ""}); 
               ur_data.push({film: 986511, rating: "", user_code: ""}); 
               ur_data.push({film: 841470, rating: "", user_code: ""}); 
               ur_data.push({film: 1045590, rating: "", user_code: ""}); 
               ur_data.push({film: 1046545, rating: "", user_code: ""}); 
               ur_data.push({film: 1027311, rating: "", user_code: ""}); 
               ur_data.push({film: 959260, rating: "", user_code: ""}); 
               ur_data.push({film: 965641, rating: "", user_code: ""}); 
               ur_data.push({film: 1112036, rating: "", user_code: ""}); 
               ur_data.push({film: 1076322, rating: "", user_code: ""}); 
               ur_data.push({film: 1110934, rating: "", user_code: ""}); initMiniVotes();
}

Is there an id in ur_data.push film that actually needs to be obtained? I tried to get from the page, it does not work because the page is reloading as it is viewed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Sisin, 2018-03-23
@newdancer

If the page is loading, then most likely an XHR request is coming, the data in it is most likely in JSON. Perhaps it would be easier to pick it up and parse it. If given the URL to pick up, more could be said.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question