gnuns / allOrigins

:alien: Pull content from any page as JSON via API

Home Page:https://allorigins.win/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Allow overriding User-Agent header

kerrickstaley opened this issue · comments

Certain APIs will block access for clients without a browser-like user-agent. For example, the request

curl 'https://mybusnow.njtransit.com/bustime/eta/getStopPredictionsETA.jsp?stop=20509'

returns an HTML page with an error message. This error is also visible when you try to access the API through allorigins.win.

However, if you pass a browser-like user-agent, the request returns XML with bus departure times:

curl 'https://mybusnow.njtransit.com/bustime/eta/getStopPredictionsETA.jsp?stop=20509' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0'

I think it'd be useful if allOrigins could take a &user_agent= parameter that overrides the user-agent in order to allow access to APIs like this.