GithubHelp home page GithubHelp logo

a7med3bdulbaset / hadith-json Goto Github PK

View Code? Open in Web Editor NEW
46.0 7.0 7.0 92.33 MB

Database of Prophet hadiths include 50,884 hadiths from 17 book, among of them the nine books

TypeScript 100.00%
hadith islam islamic muslim muslims muslim-api

hadith-json's Introduction

Hadith-json Database [1.2.0]

Hadith is the second source of Islamic law after the Quran. It is the sayings and actions of Prophet Muhammed (PBUH).

An extensive JSON-formatted database is available, containing the Hadiths - Prophet Muhammed's (PBUH) sayings and actions - in both Arabic and English. The database encompasses 17 books of Hadiths.

قاعدة بيانات شاملة بصيغة JSON، تحتوي على الأحاديث النبوية الشريفة باللغتين العربية والإنجليزية. تشمل القاعدة 17 كتاباً من كتب السنة النبوية.

Hadiths Count:

  • Total Hadiths: 50,884 Hadiths.

Books included:

  1. Sahih al-Bukhari صحيح البخاري
  2. Sahih Muslim صحيح مسلم
  3. Sunan Abi Dawud سنن أبي داود
  4. Jami` at-Tirmidhi جامع الترمذي
  5. Sunan an-Nasa'i سنن النسائي
  6. Sunan Ibn Majah سنن ابن ماجه
  7. Muwatta Malik موطأ مالك
  8. Musnad Ahmad مسند أحمد
  9. Sunan ad-Darimi سنن الدارمي
  10. Riyad as-Salihin رياض الصالحين
  11. Shamail al-Muhammadiyah الشمائل المحمدية
  12. Bulugh al-Maram بلوغ المرام
  13. Al-Adab Al-Mufrad الأدب المفرد
  14. Mishkat al-Masabih مشكاة المصابيح
  15. The Forty Hadith of al-Imam an-Nawawi الأربعون النووية
  16. The Forty Hadith Qudsi الأربعون القدسية
  17. The Forty Hadith of Shah Waliullah أربعون الشاه ولي الله

Stack:

  • Node.js
  • TypeScript
  • Cheerio.js
  • Axios
  • cli-progress

Data Source:

The data was scrapped from Sunnah.com, and was converted to JSON format using a custom script. All scripts are available in the src folder.

Data Format:

The data is available in two formats:

  1. By Book: The Hadiths are grouped by book. See all Books in the db/by_book folder.
  2. By Chapter: The Hadiths are grouped by chapter. See all Chapters in the db/by_chapter folder.
  3. Next INSHALLAH will add more formats.

See all Types in the types/index.d.ts file.

Every Hadih is an object with the following format:

interface Hadith {
	id: number;
	chapterId: number;
	bookId: number;
	arabic: string;
	english: {
		narrator: string;
		text: string;
	};
}

Commands:

  • npm install - Installs the dependencies.
  • npm run build - Compiles the TypeScript files to JavaScript.
  • npm run start - Starts the script that scrapes the data from Sunnah.com.
  • npm run dev:build - Compiles the TypeScript files to JavaScript in watch mode.
  • npm run dev:start - Starts the script that scrapes the data from Sunnah.com in watch mode.

Project Structure:

.
├── db
│   ├── by_book
│   │   │   ├── the_9_books
│   │   │   │   ├── bukhari.json
│   │   │   │   ├── muslim.json
│   │   │   │   ├── ...
│   │   │   ├── forties
│   │   │   │   ├── nawawi40.json
│   │   │   │   ├── ...
│   │   │   ├── ...
│   ├── by_chapter
│   │   ├── the_9_books
│   │   │   ├── bukhari
│   │   │   │   ├── 1.json
│   │   │   │   ├── 2.json
│   │   │   │   ├── ...
│   │   │   ├── muslim
│   │   │   │   ├── ...
│   │   │   ├── ...
│   │   ├── forties
│   │   │   ├── nawawi40
│   │   │   │   ├── 1.json
│   │   │   │   ...
│   │   │   other_books
│   │   │   │   RyadSalihin
│   │   │   │   │   ├── 1.json
│   │   ...
│   ├── by_book
│   src
│   │   ├── index.ts
│   │   ├── types
│   │   ├── helpers
│   ...

Notes:

  • In Musnad Ahmed, the chapters from 8 to 30 are missing in the source data. If you know better source for this book, please let us know.
  • The source code for scraping in the src directory is not perfect. I wrote it when I was a beginner to practice scraping. It needs refactoring. (BTW, it works fine 😅)

Contributing:

Contributions are welcome. Please open an issue or a pull request.

Conclusion:

May Allah accept this work and make it beneficial for all Muslims. Ameen.

hadith-json's People

Contributors

ahmedbaset avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hadith-json's Issues

Missing Chapters in Bukhari Book

Thanks a lot for your effort. It is really appreciated.

The following chapters are missing from the Bukhari book and their IDs have been replaced by other chapters.
2Beliefكتاب الإيمان 8 to 58
3Knowledgeكتاب العلم 59 to 134
4Ablutions (Wudu')كتاب الوضوء135 to 247
5Bathing (Ghusl)كتاب الغسل 248 to 293
6Menstrual Periodsكتاب الحيض 294 to 333
7Rubbing hands and feet with dust (Tayammum)كتاب التيمم 334 to 348
8Prayers (Salat)كتاب الصلاة 349 to 520
9Times of the Prayersكتاب مواقيت الصلاة 521 to 602

You will find كتاب الأذان has an id of 2 which should be the id of the missing chapter كتاب الإيمان.

Missing Sub-Chapters for Hadith Books (Bukhari)

Thanks a lot for your effort. It is really appreciated.

It would be great if you could also include the sub-chapters' names in Hadith books for example:
Bukhari Book -> Chapter كتاب الجمعة -> There are sub-chapters' titles for example:
(1)Chapter: The prescription of Jumu'ah prayer and Khutba(1)باب فَرْضِ الْجُمُعَةِ
(2)Chapter: The superiority of taking a bath on friday(2)باب فَضْلِ الْغُسْلِ يَوْمَ الْجُمُعَةِ، وَهَلْ عَلَى الصَّبِيِّ شُهُودُ يَوْمِ الْجُمُعَةِ أَوْ عَلَى النِّسَاءِ

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.