Use default siteinfo when online wiki not found
This commit is contained in:
parent
d2765c2a78
commit
0fd0efc3f2
1 changed files with 7 additions and 5 deletions
12
src/data.rkt
12
src/data.rkt
|
@ -62,11 +62,13 @@
|
|||
("siprop" . "general|rightsinfo")
|
||||
("format" . "json")
|
||||
("formatversion" . "2"))))
|
||||
(define data (easy:response-json res))
|
||||
(siteinfo^ (jp "/query/general/sitename" data)
|
||||
(second (regexp-match #rx"/wiki/(.*)" (jp "/query/general/base" data)))
|
||||
(license^ (jp "/query/rightsinfo/text" data)
|
||||
(jp "/query/rightsinfo/url" data)))]))
|
||||
(cond [(= (easy:response-status-code res) 200)
|
||||
(define data (easy:response-json res))
|
||||
(siteinfo^ (jp "/query/general/sitename" data)
|
||||
(second (regexp-match #rx"/wiki/(.*)" (jp "/query/general/base" data)))
|
||||
(license^ (jp "/query/rightsinfo/text" data)
|
||||
(jp "/query/rightsinfo/url" data)))]
|
||||
[else siteinfo-default])]))
|
||||
|
||||
(define/memoize (head-data-getter wikiname) #:hash hash
|
||||
;; data will be stored here, can be referenced by the memoized closure
|
||||
|
|
Loading…
Reference in a new issue