Skip to content

Instantly share code, notes, and snippets.

@dtxe
Last active December 11, 2023 17:32
Show Gist options
  • Save dtxe/9b8e1426bf71edb1248a2f185453c2cb to your computer and use it in GitHub Desktop.
Save dtxe/9b8e1426bf71edb1248a2f185453c2cb to your computer and use it in GitHub Desktop.
Scrape BibleProject discussion posts from YouVersion bible plans
#!/bin/bash
PLANID=12345678
JWTTOKEN={{TOKEN}}
for DAY in {1..365}
do
curl 'https://plans.youversionapi.com/4.0/together/$PLANID/activities?day=$DAY&page=1&order=desc&talk_it_over=0' \
-H 'authority: plans.youversionapi.com' \
-H 'x-youversion-app-version: 4' \
-H 'x-youversion-client: youversion' \
-H 'accept-language: en' \
-H 'authorization: Bearer $JWTTOKEN' \
-H 'content-type: application/json' \
-H 'accept: application/json' \
-H 'cache-control: no-cache' \
-H 'x-youversion-app-platform: web' \
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36' \
-H 'origin: https://my.bible.com' \
-H 'sec-fetch-site: cross-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://my.bible.com/' \
--compressed
-O $DAY.json
done
@bbinet
Copy link

bbinet commented Dec 11, 2023

Hi, I'm interested in your script to scrape a bible plan from youversion.
Is this script still working?
Do you know how I can get JWTTOKEN value?
Thanks.

@dtxe
Copy link
Author

dtxe commented Dec 11, 2023

I haven't used it in a while, but it should still work.

JWTTOKEN is stored in a cookie named yva when you're logged into https://bible.com. You can retrieve its value using Developer Tools under the Applications tab > Storage > Cookies or by running this snippet of code in the Developer Tools console:
window.cookieStore.get('yva').then(x => console.log(x.value))

@bbinet
Copy link

bbinet commented Dec 11, 2023

Thank you for your answer.
So with your help, I could get my token successfully, but after updating JWTTOKEN with the value from the "yva" cookie, I still get the error message:
{"error":"access_denied","error_description":"invalid or expired token"}

Any idea?
Do you think other http headers need to be updated?

@bbinet
Copy link

bbinet commented Dec 11, 2023

Also, how did you find the "https://plans.youversionapi.com/4.0/together/$PLANID/activities?day=$DAY&page=1&order=desc&talk_it_over=0" API ?
When I use the web version, I cannot see any request to the plans.youversionapi.com domain in developer tools on Network tab...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment