History

update github scraper

tweak github scraper to work again after GitHub UI update which gives back JSON data

ClasherKasten committed 3 years ago

Commit 8034fd91 parent f8161051 file · +15 −0Browse files

Unified · Split

lib/docs/scrapers/github.rb+15−0
@@ -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 end22 end
8end23end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t