A module to scrape biblehub.com, also cli app
Project description
biblehub
A python module and CLI app (Formerly BibleHubScrapper) that retrieve verses and information on those verses from biblehub.
Installation
pip3 install --pre biblehub
Currently beta testing, some bugs must be reworked.
CLI app
Simple Queries
Find verses with no information by using the find
command and no flags
biblehub find Matthew 2:4
You can retrieve single verses, a range of verses, or an entire chapter.
Informational Queries
The CLI app is also capable of retrieving information on the queried single verse queries with the optional flags
-a
(All information) -l
(Lexicon) and -t
(Treasury of Scripture)
Note: Information is only available for single verse references (i.e Genesis 1:1), multiverse references(i.e Genesis 1:1-2) will not return information on each verse yet.
To only retrieve specific information, pass in the corresponding tag:
biblehub find -c [Reference] # Also retrieves the cross-references
biblehub find -l [Reference] # Also retrieves the lexicon
biblehub find -t [Reference] # Also retrieves the treasury of scripture
As with most CLI tools, arguments can be stacked with one hyphen and the position of the arguments don't matter relative to the verse. All of these are valid queries:
biblehub find -cl [Reference] # Retrieves the cross-references and lexicon in addition to the passage
biblehub find Matthew 2:4 -c
Versioning
To retrieve all the versions for a single verse reference, use the --versions
tag
biblehub find --versions Genesis 2:4
To find a specific version (See available verses on biblehub), use the -v
tag
biblehub find -v KJV Jam 4:7
Search Queries
To search biblehub use the search
command
biblehub search Goliath
Contains optional arguments --ot
and --nt
to limit the results to the old or new testaments
Script Usage
You can import the query and get_versions methods to use in scripts.
from biblehub import find_verse, get_versions
biblehub_query = find_verse('Genesis 1:1')
all_versions = get_versions('Genesis 1:1')
print(biblehub_query.text) # In the beginning...
print(all_versions[0].passage)
By default, it will query all possible fields.
You can choose not to query certain fields by indicating in the parameters
for example:
find_verse('Genesis 1:1', get_lexicons=False)
Useful fields
print(biblehub_query.passage) # Genesis 1:1
print(biblehub_query.version) # NIV (default)
print(biblehub_query.lexicons) # Text, Hebrew words, translit, strong, and English defintions
print(biblehub_query.crfs) # Cross References
print(biblehub_query.tos) # Treasury of Scripture
print(biblehub_query.info) # Prints all the info queried on the verse. Also the same as the __str__
there are also biblehub_query.format_[field]
method that returns the specified field in an easy to read way.
Searching
from biblehub import search as b_search
list = b_search("Goliath", filter='nt')
Known Bugs
- Because of the way psalms are formatted in biblehub, if you do a multi-verse query for the psalms (i.e Psalms 23:1-5), parts of the verses will be cut off. This problem is not present in single verse queries however
- If you type in a random version (i.e
biblehub -v JOE Matthew 2:4
) it will retrieve the NIV by default as expected, but the version in the reference display will still display that unknown version. This can make for some pretty fun images though.
Contributing
If you feel like improving the codebase, adding a feature, or checking my grammar, feel free! checkout the issues I post for tasks you can help with, reference specific issues when making a PR. Make sure to send a pull request against the development branch.
Regrets
This was probably one of the most fun side projects I have worked on, sadly though I am unlikely to continue developing it. I did not begin this with the goal of making it a sustainable project, I only wanted to hash together something to help me whenever I needed to quickly lookup bible references or look at cross-references. For this reason, I did not develop tests earlier on and did not spend a lot of time on making the codebase scalable for different uses. I say all of this just to make this statement:
WRITE TESTS!!! They make life so much easier in the long term
Find this app helpful? Useful? Please let me know at joshua@joshpetit.dev!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file biblehub-2.0.1.tar.gz
.
File metadata
- Download URL: biblehub-2.0.1.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f741d23ca7f1dc7a559b5dd66dad669193743496b8bb192e69fe264b86c450e |
|
MD5 | ec4c9dfbd265b07b17c74e33103fa2c2 |
|
BLAKE2b-256 | 1c44f7dad3eab9b9c0479cef40e09004822e27c52abd84c702f58a266bc02212 |
File details
Details for the file biblehub-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: biblehub-2.0.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90feee40c18e07c32a96c70fd75a01cdd97f67449ad407392f3a5327a7a8d306 |
|
MD5 | fe723df7707afcb8b96a1ca68f8f375c |
|
BLAKE2b-256 | 1511f37c059dfd322043b9ad2f3910966af4b4e57ff18e612b19be9a93517cd0 |