From 3dd57e2099d34ddd6b87fdec6312598cd1a234e0 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 26 Jan 2023 17:29:51 -0500 Subject: [PATCH] lsb: Add Legacy Standard Bible script (parses their HTML, which is okay, and loads fast) --- lsb.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 lsb.py diff --git a/lsb.py b/lsb.py new file mode 100755 index 0000000..1793ba5 --- /dev/null +++ b/lsb.py @@ -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) -- 2.45.2