Skip to content

Commit dd75c13

Browse files
authored
Merge pull request #2015 from ClasherKasten/fix/github-scraper
2 parents 9d54736 + 8034fd9 commit dd75c13

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/docs/scrapers/github.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,20 @@ class Github < UrlScraper
44
self.type = 'github'
55

66
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
722
end
823
end

0 commit comments

Comments
 (0)