jgclark / biblegateway-to-markdown Goto Github PK
View Code? Open in Web Editor NEWParse NET Bible passage output from Bible Gateway
Parse NET Bible passage output from Bible Gateway
Bible Version: KJV
Problem: The script parses all Bible books successfully but fails on all books that are numbered i.e. 1 Samuel, 2 John, etc
Ruby 3.2.4-1 installed w/ gems
Strawberry perl 5.38.2.2 installed and running bg2md.rb
Error: the data returned from BibleGateway is empty, so stopping. Please check your usage, and if still a problem, please raise an issue on GitHub.
Error: the data returned from BibleGateway is empty, so stopping. Please check your usage, and if still a problem, please raise an issue on GitHub.
I was able to download the CSB but can't download other versions. Not sure if anyone else has run into this but any help is appreciated.
I'm running Ruby v3.0.0
All of this is way above my head, or at least at this point. I've attempted to install this on my Mac for use in Obsidian but I'm unable to get the computer to install using the provided commands. It is usually showing 'command not found' or not showing anything at all after pressing return. Any help would be appreciated. Would be helpful to have a YouTube video demonstrating install. Thank you.
Hi @jgclark, would you be willing to choose a license for the project? This would clarify if reuse/modification of the code is permitted and under which circumstances.
Hi there,
Could you help me modify the script so that it produces the footnotes and cross references as only numbers? I would like all footnotes (currently lowercase letters) and cross references (currently uppercase letters) to be one continuous numbered list. So far I have modified the script to produce the desired output at the end of the passage, but not in the passage.
This is ideally what I would like...
Lorem ipsum dolor [^3] sit amet, consectetur adipiscing elit. Maecenas[^1] molestie aliquam laoreet. Morbi imperdiet blandit nunc, ac congue diam tristique at. Donec et elit sed sapien interdum ullamcorper. Pellentesque [^2] in volutpat nibh. Praesent sodales tortor sed ornare feugiat. Sed dapibus ipsum a aliquam [^4] pulvinar.
[^1] is a footnote
[^2] is a footnote
[^3] is a cross ref
[^4] is a cross ref
I really hope it makes sense. Basically process all footnotes first, and in text give them a number instead of a letter. Then process the cross references starting with the next value after the footnotes and give them numbers instead of lettes e.g. [^AB]
This would be very valuable for me if you could at least point me in the right direction how I might make this happen.
Thank you
Luke
Not so much an issue, but I wanted to reach out to see if this kind of script could be implemented for Studylight.org as well? I think that would be really awesome!
Thanks
Hi jgclark
Thank you for providing the script. I'm new to ruby and I'm running in to some issues:
I have downloaded the ZIP file and placed the bg2md.rb file in a folder in my directory.
Running the command chmod 755 np*.rb
I get the result "No such file or directory"
Therfore running the script: bg2md.rb --version TLV --newline --copyright reference
results also in: "-bash: bg2md.rb: command not found"
Any suggestions on how to procede?
Thank you for your support.
Best Regards,
Marco
Mac OS: 11.6 - olorize, optparse, and clipboard installed and updated
Currently it only returns footnotes and copyright info!
No surprise: other sites have noticed a change in BibleGateway text layout.
I got lost after at bg2md.rb [options] reference.
i downloaded ruby, installed all the gems
bg2md.rb ran fine
but i dont know what to do with bg2md.rb
???
Thanks
Hi! I have had a couple of people running into an issue in using the script: Script Only Downloading the 1st Chapter of Every Book · Issue #15 · selfire1/BibleGateway-to-Obsidian
Somehow using v1.4.3
works however. Would you be willing to look into that?
Need to write a README, decide on a license, give appropriate dues to BG and then release.
Hi and my apologies, I am new and not experienced. Trying to execute and convert a bible to .md - getting the following error:
ruby bg2md.rb -b -c -e -r -v SCH2000 > SCH2000.md
bg2md.rb:7: syntax error, unexpected '<'
bg2md.rb:8: syntax error, unexpected '<'
Working on Linux Mint, have installed Ruby and Gems as advised. Added to PATH and made script executableThanks a lot!
Pat
I tried with many different Settings, but still get this error all the time.
Any idea, what this could be?
This is how my files looks like
---
Aliases: [1. Mose 1]
---
# 1. Mose 1
[[1. Mose]] | [[1Mo 2|1. Mose 2 →]]
***
�[0;31;49mError: could not parse data from BibleGateway: please check your usage, and if still a problem, please raise an issue on GitHub.�[0m
***
[[1. Mose]] | [[1Mo 2|1. Mose 2 →]]
Kind regards
Markus
Hello.
I really appreciate what you have done in making this program. However, I continue to have issues:
I ran "bash bg2obs.sh -v KJV -beai" into the terminal to install the KJV version of the Bible on my Mac several times. Every time I run it, it seems to grab the contents in the first chapter of the book and putting that same chapter contents for every following chapter. Otherwise, I get the "[0;31;49mError: could not parse data from BibleGateway: please check your usage, and if still a problem, please raise an issue on GitHub.�[0m" error.
Also, Sometimes ill get to see the scripture content of the first chapter (throughout the book, per book, as stated above), and then it will change to give me the error message... I see that the WEB translation that you included works fine.
I'm wondering if I'm not installing the 2 files correctly (maybe there's something I'm not understanding seeing I'm new to the terminal), or is there an issue in the program related to the KJV version? What am I missing?
One thing I found: I don't know if I understand this line in the instructions:
"Add the .rb script to your PATH, and then set it as executable (chmod 755 bg2md.rb
)"
I thought I did it, but I'm still getting only the first chapter of each book per book.
Gen 2.md
Gen 3.md
Gen 4.md
When running bg2md.rb -i -v ESV john1
, cross-reference beyond Z (AA, AB, etc.) only saves the second letter.
For example, this is the expected result:
And [^Z]the Word [^AA]became flesh and [^AB]dwelt among us
This is the actual result:
And [^Z]the Word [^A]became flesh and [^B]dwelt among us
After some debugging, I found a workaround. Disclaimer: I don't know ruby nor regex and am not a programmer.
passage.gsub!(%r{<sup class='crossreference'.*?See cross-reference (\w+)+.*?</sup>}, '[^\1]')
This is on line 388. Notice the +
at (\w+)
.
This script is amazing, I hope this is helpful!
Should it be ruby bg2md.rb -b -c -e -r -v NIV 'Jn 3.16-17' > passage.md
?
If we do ruby bg2md.rb -b -c -e -r -v NIV Jn 3.16-17 > passage.md
, ref = ARGV[0] will be Jn
instead of 1Jn 3.16-17
, right? In my test, ruby bg2md.rb -b -c -e -r -v NIV Jn 3.16-17 > passage.md
will retrieve the whole 1 John chapter 1 instead of 3:16-17.
Hey, Jonathan:
This is the first time I'm posting an "issue" on GitHub, so forgive me if I'm not following standard protocol somehow: is there any way to remove the sub-headings from being received? I've been using your Ruby script in tandem with the Bible Gateway to Obsidian shell script (as that script requires), but unless I made some mistake in following the instructions, it seems that there is a problem with the sub-headings appearing as regular text amidst the verses, which causes readings like this:
"that your charitable deed may be in secret; and your Father who sees in secret will Himself reward you openly.The Model Prayer" (supposed to be Matthew 6:4, but it has "The Model Prayer" concatenated at the end).
As you might imagine, this would become problematic if I was reading a set of verses that I wasn't familiar with and the sub-heading manages to be integrated well enough into the verses that I don't notice that it's not part of the verses.
*note: I'm using the NKJV, if that's what's causing any unintended issues with sub-headings.
I appear to have got everything running, but when I run the terminal command I am immediately met with
Calling URL <https://www.biblegateway.com/passage/?interface=print&version=NET&search=reference> ... Error: could not parse data from BibleGateway: please check your usage, and if still a problem, please raise an issue on GitHub.
Any ideas? Thank you!
I have run the next in terminal: "ruby bg2md.rb [-h -i -l -v] NET"
It returns following error:
Calling URL https://www.biblegateway.com/passage/?interface=print&version=%5D&search=%5B-h ...
Error: could not parse data from BibleGateway: please check your usage, and if still a problem, please raise an issue on GitHub.
Can anybody help?
Hi! 👋 Your script has been incredibly useful to me to import Scripture into Obsidian.
I made some changes and paired it with a bash-script to import easily into Obsidian. I would love to publish my script with your adapted version to make it easy for non-programmy folks to use the Bible in Obsidian. I published the code in this repository.
Please let me know if this usage and adaptation of your script is okay with you or if you would like me to further attribute / not use it.
I have all of the gems installed and am trying to run this simple script, but keep running into this error. Is there anything that I'm supposed to set up to bypass this?
ruby bg2md.rb -b -c -e -r -v NIV Jn 3.16-17 > passage.md
/Users/<me>/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:46:in `connect_nonblock':
SSL_connect returned=1 errno=0 peeraddr=13.224.214.78:443 state=error:
certificate verify failed (unable to get local issuer certificate) (OpenSSL::SSL::SSLError)
bg2md -v NIV -c "2 Corinthians 3:7-18"
includes the following on the end of the expected output:
## More on the NIV
## About
## Help
## Our Network
## Social
## Preferences
By submitting your email address, you understand that you will receive email communications from Bible Gateway, a division of The Zondervan Corporation, 501 Nelson Pl, Nashville, TN 37214 USA, including commercial communications and messages from partners of Bible Gateway. You may unsubscribe from Bible Gateway’s emails at any time. If you have any questions, please review our [Privacy Policy] or email us at [[email protected]].
## Preferences
The same is happening for NIVUK, NLT and ESV at least, so it looks like a global change by BibleGateway.
bg2md -v NIV -c "2 Corinthians 3:7 - 4:6"
produces 4:1-6 only.
Hey, I've run into problems trying to import the Word English Bible. Cross-references are included and all of Jesus' words are deleted (which makes a rather bland Bible).
Just bringing this to your attention, if you wouldn't want to have a look at it, just close the issue.
Here's John 10 for example (inserting ###### v
doesn't make a difference in other translations, so I would guess it doesn't here as well):
###### 1 ###### v2 ###### v3 ###### v4 ###### v5 ###### v6 Jesus spoke this parable to them, but they didn't understand what he was telling them.
###### v7 Jesus therefore said to them again, ###### v8 ###### v9 ###### v10 ###### v11 <crossref intro="10:11">[Isaiah 40:11]; [Ezekiel 34:11-12],[15],[22]</crossref> ###### v12 ###### v13 ###### v14 ###### v15 ###### v16 <crossref intro="10:16">[Isaiah 56:8]</crossref> ###### v17 <crossref intro="10:17">[Isaiah 53:7-8]</crossref> ###### v18
###### v19 Therefore a division arose again among the Jews because of these words. ###### v20 Many of them said, "He has a demon, and is insane! Why do you listen to him?" ###### v21 Others said, "These are not the sayings of one possessed by a demon. It isn't possible for a demon to open the eyes of the blind, is it?"<crossref intro="10:21">[Exodus 4:11]</crossref>
###### v22 It was the Feast of the Dedication at Jerusalem. ###### v23 It was winter, and Jesus was walking in the temple, in Solomon's porch. ###### v24 The Jews therefore came around him and said to him, "How long will you hold us in suspense? If you are the Christ, tell us plainly."
###### v25 Jesus answered them, ###### v26 ###### v27 ###### v28 ###### v29 ###### v30
###### v31 Therefore the Jews took up stones again to stone him. ###### v32 Jesus answered them,
###### v33 The Jews answered him, "We don't stone you for a good work, but for blasphemy: because you, being a man, make yourself God."
###### v34 Jesus answered them, <crossref intro="10:34">[Psalm 82:6]</crossref> ###### v35 ###### v36 ###### v37 ###### v38
###### v39 They sought again to seize him, and he went out of their hand. ###### v40 He went away again beyond the Jordan into the place where John was baptizing at first, and he stayed there. ###### v41 Many came to him. They said, "John indeed did no sign, but everything that John said about this man is true." ###### v42 Many believed in him there.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.