so the wikipedia urlfetch example from the docs (https://docs.nightbot.tv/commands/variables/urlfetch) gives me a “Wikipedia Article: Unexpected token ‘{’” error. Why, and how do i resolve?
Hiya, please see: UrlFetch json doesn't work with SSL URLs
The problem isn’t SSL, it’s the missing template string quotes from the documentation code:
!commands add !wiki Wikipedia Article: $(eval const api = $(urlfetch json https://en.wikipedia.org/w/api.php?format=json&action=opensearch&search=$(querystring)); api.error || !api[1][0] ? 'Please add a query to the search' : ${api[1][0]} - ${api[3][0]} )
vs
!commands add !wiki Wikipedia Article: $(eval const api = $(urlfetch json https://en.wikipedia.org/w/api.php?format=json&action=opensearch&search=$(querystring)); api.error || !api[1][0] ? 'Please add a query to the search' : *${api[1][0]} - ${api[3][0]}* )
where * should be `
They’re not missing per se, but they’re not visible on the docs because it looks like they are used for formatting on said docs.
Correct, that’s what i said in my comment.
Indeed you did, apologies. Might’ve not read it at first glance lol =)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.