Skip to content

Commit 539363e

Browse files
committed
add got-scraping options
1 parent ce0d6d9 commit 539363e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import dnsLookupGen from './utils/dns-lookup.js'
66
import logger from './utils/logger.js'
77
import CacheableLookup from 'cacheable-lookup'
88
import { gotSsrf } from 'got-ssrf'
9+
import { PRESETS } from 'header-generator'
910

1011
const debug = logger('index.js')
1112

@@ -22,7 +23,12 @@ export default (
2223
request: 14000 // global timeout
2324
},
2425
cache: new QuickLRU({ maxSize: 10000 }),
25-
dnsCache: new CacheableLookup({ cache: new QuickLRU({ maxSize: 100000 }) })
26+
dnsCache: new CacheableLookup({ cache: new QuickLRU({ maxSize: 100000 }) }),
27+
context: {
28+
insecureHTTPParser: false,
29+
proxyUrl: process.env.HTTP_PROXY_URL,
30+
headerGeneratorOptions: PRESETS.MODERN_WINDOWS_CHROME
31+
}
2632
},
2733
timeoutMs = 15000,
2834
canonicizeMemOpts = { cache: new QuickLRU({ maxSize: 100000 }) },

utils/http-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import got from 'got'
1+
import { got } from 'got'
22
import { gotScraping } from 'got-scraping'
33
import { gotSsrf } from 'got-ssrf'
44
import canonicizeHookGen from './canonicize.js'

0 commit comments

Comments
 (0)