You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/lib/docs/scrapers/github.rb

24 lines
489 B

module Docs
class Github < UrlScraper
self.abstract = true
self.type = 'github'
html_filters.push 'github/clean_html'
def process_response?(response)
if super(response)
return true
end
JSON.parse(response.body)
true
rescue JSON::ParserError, TypeError => e
false
end
def parse(response)
parsed = JSON.parse(response.response_body)
[parsed['payload']['blob']['richText'], parsed['title']]
end
end
end