Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NumEco Ecologie Gouv
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
Numérique et Écologie
NumEco Ecologie Gouv
Commits
df3381b9
Commit
df3381b9
authored
1 year ago
by
BOLTZ Erwin
Committed by
Geoffrey Arthaud
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix Timeout error
parent
04976728
No related branches found
No related tags found
1 merge request
!16
Fix Timeout error
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
analysis/analyser/analysis.js
+8
-8
8 additions, 8 deletions
analysis/analyser/analysis.js
with
8 additions
and
8 deletions
analysis/analyser/analysis.js
+
8
−
8
View file @
df3381b9
...
...
@@ -11,7 +11,7 @@ import { createRequire } from 'module';
import
{
getActu
,
getPolPublics
,
getRendezvous
,
getActuFile
,
getPolPublicFile
,
getRdvFile
,
getDossiersPresse
,
getDossiersPresseFile
}
from
'
./crawler.js
'
;
const
require
=
createRequire
(
import
.
meta
.
url
);
const
cpt_timeout
=
3
;
const
cpt_timeout
=
6
;
fs
.
access
(
"
../target
"
,
function
(
error
)
{
if
(
error
)
{
...
...
@@ -107,8 +107,8 @@ async function onResponseReceived(data, event) {
}
export
async
function
convertJsonToList
(
jsonfile
)
{
var
data
=
fs
.
readFileSync
(
jsonfile
,
'
utf8
'
);
var
data
=
fs
.
readFileSync
(
jsonfile
,
'
utf8
'
);
let
lfile
=
JSON
.
parse
(
data
);
return
lfile
;
}
...
...
@@ -266,7 +266,7 @@ async function articlesAnalysis(articles, analysisData, page, imageStats) {
* @param {*} analysisData
* @param {*} page
*/
async
function
pdfAnalysis
(
articles
,
analysisData
,
page
)
{
async
function
pdfAnalysis
(
articles
,
analysisData
,
page
)
{
const
stats
=
[];
analysisData
.
reset
();
let
counter
=
0
;
...
...
@@ -455,23 +455,23 @@ async function pageAnalysis(data, page, url) {
try
{
console
.
log
(
`Analyse de
${
url
}
...`
);
await
page
.
goto
(
url
,
{
waitUntil
:
'
networkidle0
'
,
waitUntil
:
cpt
>=
3
?
'
networkidle2
'
:
'
networkidle0
'
,
});
if
(
optionScroll
)
{
await
autoScroll
(
page
);
}
if
(
optionScreenshot
)
{
const
path
=
`../target/
${
url
.
substring
(
url
.
lastIndexOf
(
'
/
'
)
+
1
)}
.png`
;
await
page
.
screenshot
({
path
,
fullPage
:
true
});
}
data
.
domNbElements
=
await
domNbElements
(
page
);
break
;
}
catch
(
error
)
{
catch
(
error
)
{
if
(
cpt
<
cpt_timeout
)
{
cpt
+=
1
;
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
1000
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment