Created
September 10, 2018 19:16
-
-
Save acagastya/99fe3a282fb13141d408aef15a30c3ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from bs4 import BeautifulSoup as bsp | |
import requests | |
import sys | |
url = 'https://www.biblegateway.com/passage/?version=KJV&search=' + str(sys.argv[1]) + '%20' + str(sys.argv[2]) | |
page = requests.get(url) | |
if page.status_code == 404: | |
print("Verse not found.") | |
sys.exit(0) | |
if page.status_code is not 200: | |
printf(page.status_code) | |
sys.exit(0) | |
soup = bsp(page.text, "lxml") | |
try: | |
verse = soup.find("span", {"class": "text"}) | |
except TypeError: | |
print("Verse not found.") | |
sys.exit(0) | |
for sup in verse("sup"): | |
sup.decompose() | |
for v in verse: | |
print(v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment