File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -3,3 +3,21 @@ export const ACTOR_CHEERIO_CHECKER_NAME = 'lukaskrivka/website-checker-cheerio';
3
3
export const ACTOR_PUPPETEER_CHECKER_NAME = 'lukaskrivka/website-checker-puppeteer' ;
4
4
5
5
export const ACTOR_PLAYWRIGHT_CHECKER_NAME = 'lukaskrivka/website-checker-playwright' ;
6
+
7
+ export const DEFAULT_COSTS = {
8
+ COMPUTE_UNIT : 0.25 ,
9
+ RESIDENTIAL_GB : 12.5 ,
10
+ }
11
+
12
+ export const TABLE_FIELDS_ORDER = [
13
+ 'url' ,
14
+ 'checkerType' ,
15
+ 'proxyUsed' ,
16
+ 'totalPages' ,
17
+ 'success' ,
18
+ 'successRate' ,
19
+ 'estimatedCostPerRequest' ,
20
+ 'computeUnitsPerRequest' ,
21
+ 'residentialGBsPerRequest' ,
22
+ 'runUrl'
23
+ ]
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { convertInputToActorConfigs } from './configs.js';
6
6
import { waitForRunToFinishAndPushData , startRun } from './startRunAndPool.js' ;
7
7
8
8
import type { ActorInputData , FrontendActorState , PreparedActorConfig } from './typedefs.js' ;
9
+ import { TABLE_FIELDS_ORDER } from './constants.js' ;
9
10
10
11
const env = Actor . getEnv ( ) ;
11
12
@@ -86,6 +87,6 @@ Actor.main(async () => {
86
87
await Actor . setValue ( 'STATE' , state ) ;
87
88
88
89
log . info ( `\nChecking ${ state . totalUrls } URLs completed!` ) ;
89
- log . info ( `Please go to https: //api.apify.com/v2/datasets/${ env . defaultDatasetId } /items?clean=true&format=html to see the results` ) ;
90
- log . info ( `Go to https://api.apify.com/v2/datasets/ ${ env . defaultDatasetId } /items?clean=true&format=json for the JSON output `) ;
90
+ log . info ( `NICER TABLE VIEW:\nhttps: //api.apify.com/v2/datasets/${ Actor . getEnv ( ) . defaultDatasetId } /items?clean=true&format=html`
91
+ + `&fields= ${ TABLE_FIELDS_ORDER . join ( ',' ) } `) ;
91
92
} ) ;
Original file line number Diff line number Diff line change 1
1
import { Actor , ActorRun } from 'apify' ;
2
2
3
+ import { DEFAULT_COSTS } from './constants.js' ;
3
4
import type { PreparedActorConfig , ActorCheckSimplifiedOutput , FixedActorRun } from './typedefs.js' ;
4
5
5
6
export async function startRun ( run : PreparedActorConfig ) {
@@ -28,6 +29,8 @@ export async function waitForRunToFinishAndPushData(runConfig: PreparedActorConf
28
29
value . residentialGBs = Number ( residentialGBs . toFixed ( 8 ) ) ;
29
30
value . residentialGBsPerRequest = Number ( ( residentialGBs / value . totalPages ) . toFixed ( 8 ) ) ;
30
31
value . proxyUsed = runConfig . proxyUsed ;
32
+ value . estimatedCost = Number ( ( computeUnits * DEFAULT_COSTS . COMPUTE_UNIT + residentialGBs * DEFAULT_COSTS . RESIDENTIAL_GB ) . toFixed ( 6 ) ) ;
33
+ value . estimatedCostPerRequest = Number ( ( value . estimatedCost / value . totalPages ) . toFixed ( 6 ) ) ;
31
34
32
35
if ( runConfig . input [ 'playwright.chrome' ] ) {
33
36
value . playwrightBrowser = 'chrome' ;
You can’t perform that action at this time.
0 commit comments