1
0

github.rb 489 B

1234567891011121314151617181920212223
  1. module Docs
  2. class Github < UrlScraper
  3. self.abstract = true
  4. self.type = 'github'
  5. html_filters.push 'github/clean_html'
  6. def process_response?(response)
  7. if super(response)
  8. return true
  9. end
  10. JSON.parse(response.body)
  11. true
  12. rescue JSON::ParserError, TypeError => e
  13. false
  14. end
  15. def parse(response)
  16. parsed = JSON.parse(response.response_body)
  17. [parsed['payload']['blob']['richText'], parsed['title']]
  18. end
  19. end
  20. end