|
|
@ -195,15 +195,26 @@ class FeedService extends SiteService { |
|
|
|
} |
|
|
|
|
|
|
|
async load (url) { |
|
|
|
const options = { }; |
|
|
|
const fetchOptions = { |
|
|
|
headers: { |
|
|
|
'user-agent': this.userAgent.toString(), |
|
|
|
'Accept-Language': 'en-US', |
|
|
|
}, |
|
|
|
const headers = { |
|
|
|
'User-Agent': `DtpNewsroom/${this.dtp.pkg.version} (https://sites.digitaltelepresence.com/)`, |
|
|
|
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", |
|
|
|
'Accept-Encoding': "gzip, deflate, br", |
|
|
|
'Accept-Language': "en-US,en;q=0.9", |
|
|
|
}; |
|
|
|
const response = await FeedExtractor.extract(url, options, fetchOptions); |
|
|
|
return response; |
|
|
|
if (url.includes('newsmax.com')) { |
|
|
|
headers.Referrer = "https://www.newsmax.com/rss/"; |
|
|
|
headers['User-Agent'] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"; |
|
|
|
} |
|
|
|
|
|
|
|
this.log.debug('fetching RSS feed content', { headers }); |
|
|
|
|
|
|
|
const response = await fetch(url, { method: 'GET', headers }); |
|
|
|
if (!response.ok) { |
|
|
|
throw new SiteError(response.status, response.statusText); |
|
|
|
} |
|
|
|
|
|
|
|
const xml = await response.text(); |
|
|
|
return FeedExtractor.extractFromXml(xml); |
|
|
|
} |
|
|
|
|
|
|
|
async createEntry (feed, entryDefinition) { |
|
|
|