我們有時差,將採取輸入,例如BOT:是否有從不提供API的網站抓取文本的替代方法?
bible John 3:17 (ESV)
這將變成一個電話
https://www.biblegateway.com/passage/?search=John+3:17&version=ESV
所以,我們已經完蛋了,現在是我們會得到:
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.
這適用於小請求,例如bible John 3:1-4
- 但是,如果我們請求較大的部分,說明字段會在某個點被截斷。因此,如果我們要做bible John 3
,它只會返回約翰1的前5個左右的經文。
除了上面的捲曲之外,還有更好的方法可以去解決嗎?在包含全文響應的唯一其他地方是原始的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. ... ]
我們是否應該尋找的不僅僅是HTTP這個請求其他的東西嗎?
網站與任何你喜歡的語言,也許Java和JSoup或Python的東西... – Marged