I'm using ROME to poll and aggregate RSS feeds that refreshes every twenty minutes. To circumvent the possible lack of a User-Agent, I artificially added the one I retrived from my installation of Chrome. The relevant code bit looks like this:
URLConnection connection = new URL(feed.getFeedUrl()).openConnection();
connection.setRequestProperty("User-Agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36");
SyndFeedInput input = new SyndFeedInput();
XmlReader reader = new XmlReader(connection.getInputStream(),
"text/html; charset=UTF-8", true);
SyndFeed syndFeed = input.build(reader);
(feed.getFeedUrl()
returns the URL for a feed as a String). This works for most feeds I'm polling, but does not for the one located at https://eurovoix.com/feed/
, which returns HTTP error code 403 ("Forbidden") upon response. The feed works fine when called from the browser. What could be causing this?
Edit: Attempting to use the solution from this thread -- adding CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
-- does not resolve the issue, unfortunately.