Pandoc: User Agent argument switch if downloading content/images

Created on 26 Jan 2017  路  5Comments  路  Source: jgm/pandoc

Is it possible to allow the user to select/input a specific user agent for when pandoc retrieves files or data from a server?

For instance, I am unable to retrieve images from Facebook, which instead complains that the browser I am using is not supported. Unfortunately, I could not find a way to change the user agent myself.

Many thanks in advance :)

good first issue

Most helpful comment

Maybe we shouldn't close this. After all, it would be
possible to have pandoc do something like

setDefaultHeader "User-Agent" $ Just "A very popular browser"

when fetching if a PANDOC_USER_AGENT environment variable is
set, or if a command-line option is used...

So I think it's worth keeping this open as a feature
request.

All 5 comments

pandoc does not support this out of the box. however, you can either:

  • write a script (or pandoc filter) to download the files with curl or wget to the file system, or
  • use a proxy server transparently, pandoc respects the environment variable, e.g.: export http_proxy=http://127.0.0.1:3142/

Maybe we shouldn't close this. After all, it would be
possible to have pandoc do something like

setDefaultHeader "User-Agent" $ Just "A very popular browser"

when fetching if a PANDOC_USER_AGENT environment variable is
set, or if a command-line option is used...

So I think it's worth keeping this open as a feature
request.

Okay, sure.. if this feature request is common enough and easy enough to implement...

btw, this would probably go into the openURL function

Thank you so very much for both the guidance and reconsidering the ticket :)

Note: I've removed this behavior, since we now have a --request-header option and you can do --request-header User-Agent:foo

Was this page helpful?
0 / 5 - 0 ratings