README.md in html2rss-0.5.2 vs README.md in html2rss-0.6.0

- old
+ new

@@ -46,12 +46,22 @@ Since 0.5.0 it is possible to scrape and process JSON. Adding `json: true` to the channel config will convert the JSON response to XML. -Example: +Feed config: +```yaml +channel: + url: https://example.com + title: "Example with JSON" + json: true +# ... +``` + +Imagine this HTTP response: + ```json { "data": [{ "title": "Headline", "url": "https://example.com" }] } ``` @@ -70,9 +80,28 @@ ``` Your items selector would be `data > datum`, the item's link selector would be `url`. Under the hood it uses ActiveSupport's [`Hash.to_xml`](https://apidock.com/rails/Hash/to_xml) core extension for the JSON to XML conversion. + +## Set any HTTP header in the request + +You can add any HTTP headers to the request to the channel URL. +You can use this to e.g. have Cookie or Authorization information being sent or to overwrite the User-Agent. + +```yaml +channel: + url: https://example.com + title: "Example with http headers" + headers: + "User-Agent": "html2rss-request" + "X-Something": "Foobar" + "Authorization": "Token deadbea7" + "Cookie": "monster=MeWantCookie" +# ... +``` + +The headers provided by the channel will be merged into the global headers. ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.