fix getting 403 when parsing some rss url by setting a user agent in the request

This commit is contained in:
Hongbo Wu
2023-09-27 10:38:49 +08:00
parent bebcaaf44b
commit 010e2841da
2 changed files with 13 additions and 1 deletions

View File

@ -118,9 +118,16 @@ Sentry.GCPFunction.init({
const signToken = promisify(jwt.sign)
const parser = new Parser({
timeout: 60000, // 60 seconds
maxRedirects: 10,
customFields: {
item: [['link', 'links', { keepArray: true }], 'published', 'updated'],
},
headers: {
// some rss feeds require user agent
'User-Agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
},
})
// get link following the order of preference: via, alternate, self