feat: added support for customUserAgent (#2825)

This commit is contained in:
Wyatt Johnson
2020-02-05 16:35:57 +00:00
committed by GitHub
parent 2bf3e34218
commit 86191e388a
6 changed files with 114 additions and 5 deletions
+6 -3
View File
@@ -119,9 +119,12 @@ export default (ctx: GraphContext) => ({
// This typecast is needed because the custom `ms` format does not return
// the desired `number` type even though that's the only type it can
// output.
scraper.scrape(url, (ctx.config.get(
"scrape_timeout"
) as unknown) as number)
scraper.scrape(
url,
(ctx.config.get("scrape_timeout") as unknown) as number,
ctx.tenant.stories.scraping.customUserAgent,
ctx.tenant.stories.scraping.proxyURL
)
),
{
// Disable caching for the DataLoader if the Context is designed to be
@@ -1150,6 +1150,12 @@ type StoryScrapingConfiguration {
the [proxy-agent](https://www.npmjs.com/package/proxy-agent) package.
"""
proxyURL: String
"""
customUserAgent when specified will override the user agent used by fetch
requests made during the scraping process.
"""
customUserAgent: String
}
"""
@@ -3519,6 +3525,12 @@ input StoryScrapingConfigurationInput {
the [proxy-agent](https://www.npmjs.com/package/proxy-agent) package.
"""
proxyURL: String
"""
customUserAgent when specified will override the user agent used by fetch
requests made during the scraping process.
"""
customUserAgent: String
}
"""