~earboxer/cgi-bin

3dd57e2099d34ddd6b87fdec6312598cd1a234e0 — Zach DeCook 1 year, 1 month ago 0670aba
lsb: Add Legacy Standard Bible script

(parses their HTML, which is okay, and loads fast)
1 files changed, 20 insertions(+), 0 deletions(-)

A lsb.py
A lsb.py => lsb.py +20 -0
@@ 0,0 1,20 @@
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import sys
import os
import requests

def main(qs):
  url="https://read.lsbible.org/?q="+qs
  r = requests.get(url)
  soup = BeautifulSoup(r.text)
  passage = soup.find_all("div",attrs={"class":"passage"})[0]
  # remove verse numbers
  for versenumber in passage.find_all("small"):
    versenumber.decompose()
  # Print text portions, separated by a space.
  print(passage.get_text(" "))

if __name__ == '__main__':
  qs = os.getenv("QUERY_STRING") or (sys.argv[1] if len(sys.argv) >= 2 else '')
  main(qs)