tweak github scraper to work again after GitHub UI update which gives back JSON data
Unified · Split
| @@ -4,5 +4,20 @@ module Docs · 3 unmodified lines | |||
| 4 | self.type = 'github' | 4 | self.type = 'github' |
| 5 | 5 | ||
| 6 | html_filters.push 'github/clean_html' | 6 | html_filters.push 'github/clean_html' |
| 7 | |||
| 8 | def process_response?(response) | ||
| 9 | if super(response) | ||
| 10 | return true | ||
| 11 | end | ||
| 12 | JSON.parse(response.body) | ||
| 13 | true | ||
| 14 | rescue JSON::ParserError, TypeError => e | ||
| 15 | false | ||
| 16 | end | ||
| 17 | |||
| 18 | def parse(response) | ||
| 19 | parsed = JSON.parse(response.response_body) | ||
| 20 | [parsed['payload']['blob']['richText'], parsed['title']] | ||
| 21 | end | ||
| 7 | end | 22 | end |
| 8 | end | 23 | end |