Created
August 19, 2017 17:23
-
-
Save bsag/f3e4ff55ad8c84ba38fe752f5168b8c3 to your computer and use it in GitHub Desktop.
Code to parse Goodreads feed in Huginn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"instructions": { | |
"title": "{{title}} by {{author.name}}, {{published.year}}", | |
"body": "<p>{% regex_replace \"^(?<pt1>.+/)(?<idcode>\\d+)s(?<pt2>/.+)$\" in %}{{cover.source}}{% with %}{{ pt1 }}{{ idcode }}l{{ pt2 }}{% endregex_replace %}<\/p><p>My rating: {{rating.num}} of 5 stars<\/p><p>{{review.text}}<\/p><p>Read all my reviews on <a href=\"https://www.goodreads.com/user/show/33331686-bsag\">Goodreads<\/a><\/p>" | |
}, | |
"matchers": [ | |
{ | |
"path": "{{description}}", | |
"regexp": "author:\\s*(?<name>.+?)<br>", | |
"to": "author" | |
}, | |
{ | |
"path": "{{description}}", | |
"regexp": "book published:\\s*(?<year>\\d\\d\\d\\d?)<br>", | |
"to": "published" | |
}, | |
{ | |
"path": "{{description}}", | |
"regexp": "rating:\\s*(?<num>\\d+?)<br>", | |
"to": "rating" | |
}, | |
{ | |
"path": "{{description}}", | |
"regexp": "review:\\s*<br>(?<text>.+?)$", | |
"to": "review" | |
}, | |
{ | |
"path": "{{description}}", | |
"regexp": "(?<source><img.+?>)", | |
"to": "cover" | |
} | |
], | |
"mode": "clean" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment