Code Monkey home page Code Monkey logo

jw-epub-parser's Introduction

JW EPUB Parser

CI CD semantic-release: angular jw-epub-parser Quality Gate Status Code Smells Maintainability Rating Security Rating Bugs Vulnerabilities

epub-badge@3x

An EPUB Parser to extract the needed source materials from Meeting Workbook and Watchtower Study EPUB files.

Install

npm i jw-epub-parser

Usage

// browser
import { loadEPUB } from 'jw-epub-parser';

// node esm
import { loadEPUB } from 'jw-epub-parser/dist/node/index.js';

// node commonjs
const { loadEPUB } = require('jw-epub-parser/dist/node/index.cjs');

// sample usage
const epubJW = await loadEPUB('/path/to/file.epub');

const epubJW = await loadEPUB({ url: epubUrl });

loadEPUB(epubData)

function: asynchronous

epubData

type: string or blob or url

It can be the path to the EPUB file or EPUB file's blob or url to download the EPUB file.

Return

By calling the loadEPUB function, it will return an array of objects with the following properties:

Meeting Workbook Data

Name Type Description
mwb_week_date string Week date. For enhanced parsing, it is formatted as yyyy/mm/dd
mwb_week_date_locale* string Week date
mwb_weekly_bible_reading string Weekly Bible Reading
mwb_song_first integer First song
mwb_tgw_talk string 10 min talk title of the Treasures from God’s Word
mwb_tgw_talk_title* string 10 min talk full title of the Treasures from God’s Word
mwb_tgw_gems_title string Spiritual gems full title of the Treasures from God’s Word
mwb_tgw_bread string Bible Reading for student
mwb_tgw_bread_title* string Bible Reading assignment full title for student
mwb_ayf_count integer Number of parts in Apply Yourself to the Field Ministry
mwb_ayf_part1 string Part 1 in Apply Yourself to the Field Ministry
mwb_ayf_part1_time* integer Timing of Part 1 in Apply Yourself to the Field Ministry
mwb_ayf_part1_type* string Type of Part 1 in Apply Yourself to the Field Ministry
mwb_ayf_part1_title* string Assignment full title of Part 1 in Apply Yourself to the Field Ministry
mwb_ayf_part2 string Part 2 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is 1
mwb_ayf_part2_time* integer Timing of Part 2 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is 1
mwb_ayf_part2_type* string Type of Part 2 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is 1
mwb_ayf_part2_title* string Assignment full title of Part 2 in Apply Yourself to the Field Ministry
mwb_ayf_part3 string Part 3 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is less than 3
mwb_ayf_part3_time* integer Timing of Part 3 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is less than 3
mwb_ayf_part3_type* string Type of Part 3 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is less than 3
mwb_ayf_part3_title* string Assignment full title of Part 3 in Apply Yourself to the Field Ministry
mwb_ayf_part4 string Part 4 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is less than 4
mwb_ayf_part4_time* integer Timing of Part 4 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is less than 4
mwb_ayf_part4_type* string Type of Part 4 in Apply Yourself to the Field Ministry. This property will not be available if mwb_ayf_count is less than 4
mwb_ayf_part4_title* string Assignment full title of Part 4 in Apply Yourself to the Field Ministry
mwb_song_middle integer Middle song
mwb_lc_count integer Number of parts in Living as Christians
mwb_lc_part1 string Part 1 in Living as Christians
mwb_lc_part1_time* integer Timing of Part 1 in Living as Christians
mwb_lc_part1_content* string Content of Part 1 in Living as Christians
mwb_lc_part1_title* string Full title of Part 1 in Living as Christians
mwb_lc_part2 string Part 2 in Living as Christians. This property will not be available if mwb_lc_count is 1
mwb_lc_part2_time* integer Timing of Part 2 in Living as Christians. This property will not be available if mwb_lc_count is 1
mwb_lc_part2_content* string Content of Part 2 in Living as Christians. This property will not be available if mwb_lc_count is 1
mwb_lc_part2_title* string Full title of Part 2 in Living as Christians
mwb_lc_cbs string Congregation Bible Study source material
mwb_lc_cbs_title* string Congregation Bible Study assignment full title
mwb_song_conclude integer or string Concluding song. When the song number is out of range, it will be the default text from the Meeting Workbook.

Watchtowet Study Data

Name Type Description
w_study_date string Week date. For enhanced parsing, it is formatted as yyyy/mm/dd
w_study_date_locale* string Week date
w_study_title string Watchtower Study Article Title
w_study_opening_song integer Opening Song for the Watchtower Study
w_study_concluding_song integer Concluding Song for the Watchtower Study

* These properties are only available when enhanced parsing is available for the language you parse.

Currently, we only support enhanced parsing for the following languages:

Enlish
French
German
Italian
Japanese
Madagascar Sign Language, Malagasy
Polish, Portuguese Brazil
Romanian, Russian
Spanish
Tagalog, Tandroy, Tankarana, Turkish, Twin
Ukrainian
Vezo

For the other languages, you may use your own method to convert these outputs according to your needs to get the needed informations. If you want to contribute and add your language in the enhanced parsing list, or edit your language rules, please follow this guide.

Sample Output

Here are how the results of this module look like:

With enhanced parsing

Meeting Workbook Data

[
  {
    mwb_week_date: '2024/07/01',
    mwb_week_date_locale: 'JULY 1-7',
    mwb_weekly_bible_reading: 'PSALMS 57-59',
    mwb_song_first: 148,
    mwb_tgw_talk: 'Jehovah Frustrates Those Who Oppose His People',
    mwb_tgw_talk_title: '1. Jehovah Frustrates Those Who Oppose His People',
    mwb_tgw_gems_title: '2. Spiritual Gems',
    mwb_tgw_bread: 'Ps 59:1-17 (th study 12)',
    mwb_tgw_bread_title: '3. Bible Reading',
    mwb_ayf_count: 2,
    mwb_ayf_part1: 'Discussion. Play the VIDEO, and then discuss lmd lesson 7 points 1-2.',
    mwb_ayf_part1_time: 7,
    mwb_ayf_part1_type: 'Perseverance​—What Paul Did',
    mwb_ayf_part1_title: '4. Perseverance​—What Paul Did',
    mwb_ayf_part2: 'Discussion based on lmd lesson 7 points 3-5 and “See Also.”',
    mwb_ayf_part2_time: 8,
    mwb_ayf_part2_type: 'Perseverance​—Imitate Paul',
    mwb_ayf_part2_title: '5. Perseverance​—Imitate Paul',
    mwb_song_middle: 65,
    mwb_lc_count: 1,
    mwb_lc_part1: 'Local Needs',
    mwb_lc_part1_time: 15,
    mwb_lc_part1_title: '6. Local Needs',
    mwb_lc_cbs: 'bt chap. 12 ¶1-6, box on p. 96',
    mwb_lc_cbs_title: '7. Congregation Bible Study',
    mwb_song_conclude: 78
  },
	...
]

Watchtower Study Data

[
  {
    w_study_date: '2024/09/09',
    w_study_date_locale: 'Study Article 27: September 9-15, 2024',
    w_study_title: 'Be Courageous Like Zadok',
    w_study_opening_song: 73,
    w_study_concluding_song: 126
  },
	...
]

Without enhanced parsing

Meeting Workbook Data

[
  {
    mwb_week_date: '7月1-7日',
    mwb_weekly_bible_reading: '诗篇57-59篇',
    mwb_song_first: 148,
    mwb_tgw_talk: '1.耶和华不会让反对我们的人得逞 (10分钟)',
    mwb_tgw_gems_title: '2.经文宝石 (10分钟)',
    mwb_tgw_bread: '3.经文朗读 (4分钟)诗59:1-17(《教导》第12课)',
    mwb_ayf_count: 2,
    mwb_ayf_part1: '4.坚持不懈——保罗怎么做 (7分钟)节目包括讨论。先观看短片,然后讨论《爱心》第7课1-2点。',
    mwb_ayf_part2: '5.坚持不懈——向保罗学习 (8分钟)讨论《爱心》第7课3-5点以及“请看”。',
    mwb_song_middle: 65,
    mwb_lc_count: 1,
    mwb_lc_part1: '6.本地需要 (15分钟)',
    mwb_lc_cbs: '7.会众研经班 (30分钟)《作见证》第12章1-6段以及96页的附栏',
    mwb_song_conclude: 78
  },
	...
]

Watchtower Study Data

[
  {
    w_study_date: '研究班课文27:2024年9月9-15日',
    w_study_title: '效法撒督,显出勇气',
    w_study_opening_song: 73,
    w_study_concluding_song: 126
  },
	...
]

jw-epub-parser's People

Contributors

dependabot[bot] avatar rhahao avatar semantic-release-bot avatar sws2apps-admin avatar ux-git avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

jw-epub-parser's Issues

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Help for using jw-epub-parser

Hi @rhahao,
thanks for your great work.
Your jw-epub-parser is a great project.

I would like to use it. I have the following problem:

  1. At the beginning I wanted to use your app in the browser via URL. However, the website does not allow it because of CORS.

  2. Secondly, I wanted to read the file locally in the browser via and pass it on as readAsDataURL(blob). But that didn't work. The following error message appears:
    "You are using the Browser version of jw-epub-parser. Please switch to the Node version if needed."

What am I doing wrong?
How can I use it correctly?

Thank you for your answer
best regards

Issue on React.js

We have noticed that, when used with React application, this module does not compiled well when bundling the production code.

We are currently working to find a way to solve that, or at least to offer a workaround.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.