bs4 keep/drop all relevant
This commit is contained in:
parent
3aedfe2741
commit
dd8204496f
23
app.py
23
app.py
@ -27,8 +27,6 @@ def index():
|
|||||||
}.get(version)
|
}.get(version)
|
||||||
|
|
||||||
if bible_id and reference:
|
if bible_id and reference:
|
||||||
# ESV API endpoint
|
|
||||||
url = f'https://api.esv.org/v2/verse?verse={reference}&bible={bible_id}'
|
|
||||||
webfriendlyref=reference.replace(' ','%20').replace(':','%3A')
|
webfriendlyref=reference.replace(' ','%20').replace(':','%3A')
|
||||||
url = f'https://www.biblegateway.com/passage/?search={webfriendlyref}&version={bible_id}'
|
url = f'https://www.biblegateway.com/passage/?search={webfriendlyref}&version={bible_id}'
|
||||||
print(url)
|
print(url)
|
||||||
@ -42,8 +40,25 @@ def index():
|
|||||||
else:
|
else:
|
||||||
error = "Please provide both a reference and a version."
|
error = "Please provide both a reference and a version."
|
||||||
|
|
||||||
# Print to stdout
|
soup = BeautifulSoup(verse, 'html.parser')
|
||||||
print(f"Reference: {reference}, Version: {version}, Verse: {verse}, Error: {error}")
|
verse_html = ''
|
||||||
|
for sp in soup.find_all('div',class_='footnotes'):
|
||||||
|
sp.decompose()
|
||||||
|
for sp in soup.find_all('sup',class_='footnote'):
|
||||||
|
sp.decompose()
|
||||||
|
for sp in soup.find_all('sup',class_='crossreference'):
|
||||||
|
sp.decompose()
|
||||||
|
for sp in soup.find_all('a',class_='full-chap-link'):
|
||||||
|
sp.decompose()
|
||||||
|
for sp in soup.find_all('div',class_='crossrefs'):
|
||||||
|
sp.decompose()
|
||||||
|
|
||||||
|
for sp in soup.find_all('div',class_='passage-content'):
|
||||||
|
verse_html = verse_html + sp.prettify()
|
||||||
|
|
||||||
|
print(verse_html)
|
||||||
|
|
||||||
|
print(f"Reference: {reference}, Version: {version}, Error: {error}")
|
||||||
|
|
||||||
return render_template('index.html', reference=reference, version=version, verse=verse, error=error)
|
return render_template('index.html', reference=reference, version=version, verse=verse, error=error)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user