S
S
Shakir Yakubov2020-06-04 18:22:08
Parsing
Shakir Yakubov, 2020-06-04 18:22:08

Why doesn't phantomjs parse everything?

There is a site with court cases, from there you need to parse each case. For some reason, the parser is parsing, but not all cases are from the site. The parseTokenJSON function parses JSON in which the token is stored, which is then substituted into the link, parseCaseJSON, this one actually parses by reference.

function parseTokenJSON(link) {
   page.open(link, function (status) {
       phantom.cookiesEnabled;
       phantom.cookies;
       data = page.plainText;
       json = JSON.parse(data);
       token = json['id'];
       formTokenLink(token);
       });
   //page.close();
}

function parseCaseJSON(link) {
   //  setTimeout( function () {
       page.open(link, function (status) {
           source = page.plainText;
           array = JSON.parse(source);
           console.log(currentPage);   
           console.log(link);
           //var article = array.result.data[0].article;
           //console.log(article);
           //console.log(array.result.data.(0).article);
           //console.log(array.result.data);
           //var r = JSON.stringify(array, null, 2);
           //fs.write(path, r, 'w');
           currentPage++;
           console.log(JSON.stringify(array, null, 2));
           visitSite();
   });
       //}, 5040);
   //page.close();
}

As a result, it turns out that starting from the first case and some further, it writes "result": null, "finished": false. Help please, can anyone know why this is happening. I am attaching a photo of the work of the parser:
5ed91188261f9565852877.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2020-06-04
@Sanasol

Why did you uncover phantomjs to parse api?
Wouldn't it be easier to run node.js with the same script?

"result": null, "finished": false

What they give, then it parses, do you want to be helped here to get something that the api does not give away?
If it is displayed on the site, then it is taken from somewhere else, and not from this api.
Search.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question