We have a bot for Slack that will take input such as:
bible John 3:17 (ESV)
This will transform into a call to
https://www.biblegateway.com/passage/?search=John+3:17&version=ESV
So, what we've done for now is to just grep out the og.description
, e.g., for the above, we'd get:
curl 'https://www.biblegateway.com/passage/?search=John+3:17&version=ESV' | grep "og:description" | sed 's/.*content="//' | sed 's/".*//'
For God did not send his Son into the world to condemn the world, but in order that the world might be saved through him.
This works great for small requests, e.g., bible John 3:1-4
-- however, if we request larger sections, the description field is truncated at a certain point. So if we were to do bible John 3
, it will only return the first 5 or so verses from John 1.
Is there a better way to go about this, other than the curl above? The only other place in the response that contains the full text is the raw html, e.g.,:
<h1 class="passage-display"> <span class="passage-display-bcv">John 3</span><span class="passage-display-version">English Standard Version (ESV)</span></h1> [ ... etc. etc. ... ]
Should we be looking at something other than just http requests for this?