Tidak Ada Deskripsi https://github.com/anas-elgarhy/alquran-cloud-api
snyk-bot 541d29fb09 fix: upgrade com.fasterxml.jackson.core:jackson-databind from 2.16.0 to 2.17.2 | 5 bulan lalu | |
---|---|---|
.github | 1 tahun lalu | |
.idea | 1 tahun lalu | |
.m2 | 2 tahun lalu | |
Screenshots | 2 tahun lalu | |
src | 2 tahun lalu | |
.editorconfig | 1 tahun lalu | |
.gitignore | 1 tahun lalu | |
.mergify.yml | 1 tahun lalu | |
CODE_OF_CONDUCT.md | 2 tahun lalu | |
CONTRIBUTING.md | 2 tahun lalu | |
LICENSE.txt | 2 tahun lalu | |
README.md | 1 tahun lalu | |
pom.xml | 4 bulan lalu | |
renovate.json | 1 tahun lalu |
Step 1. Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Step 2. Add the dependency
<dependency>
<groupId>com.github.anas-elgarhy</groupId>
<artifactId>alquran-cloud-api</artifactId>
<version>0.4.4</version>
</dependency>
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.anas-elgarhy:alquran-cloud-api:0.4.4'
}
public class Example1 {
public static void main(String[] args) throws IOException {
Ayah ayah = Ayah.getAyah(1); // Get the first ayah in the quaran in arabic edition
System.out.println(ayah.getText());
System.out.println("***");
System.out.println("----- آية عشوائية -----");
Ayah randomAyah = Ayah.getRandomAyah(); // Get a random ayah in the quaran in arabic edition
Surah surah = randomAyah.getSurah(); // Get the surah of the random ayah
System.out.println(randomAyah.getText() + " - من " + surah.getName());
System.out.println("***");
Surah surah2 = Surah.getSurah(1); // Get the first surah in the quaran in arabic edition
System.out.println(surah2.getName());
System.out.println("الآيات: ");
for (Ayah a : surah2.getAyahs()) {
System.out.println(a.getText() + " (" + a.getNumberInSurah() + ")");
}
}
}
public class Example2 {
public static void main(String[] args) throws IOException {
Edition[] editions = Edition.getEditions(); // Get all available editions
System.out.println("The number of available editions: " + editions.length);
System.out.println("Editions: ");
for (Edition edition : editions) {
System.out.println(edition.getName() + " (" + edition.getIdentifier() + ")" +
" - Edition type: " + edition.getFormat().toString());
}
}
}
public class Example3 {
public static void main(String[] args) throws IOException {
// Get th all available editions in specific language
Edition[] editionsInEnglish = Edition.getEditions("en");
System.out.println("The number of available editions in English: " + editionsInEnglish.length);
// Get th all available editions in specific language and format (audio or text) and type (quran or translation, etc)
// null means all
Edition[] editionsInEnglishAudio = Edition.getEditions(EditionFormat.AUDIO, "en", null);
System.out.println("The number of available editions in English audio: " + editionsInEnglishAudio.length);
Ayah ayah = Edition.getAyah(1, editionsInEnglishAudio[0]); // Get the first ayah in the quaran in specific edition
// Becose the audio editions also have the text editions insiw, and usually the text editions are arabic.
System.out.println(ayah.getText());
System.out.println(ayah.getAudioUrl()); // Get the audio url of the ayah in 192 kbps.
// Get the audio urls in other bitrates, returns same url if no other bitrates.
System.out.println(Arrays.toString(ayah.getSecondaryAudioUrls()));
Edition edition = editionsInEnglish[0];
System.out.println(edition.getName());
System.out.println(edition.getType());
System.out.println(edition.getFormat());
Ayah ayahFromEdition = Ayah.getAyah(1, edition); // Get the first ayah in the quaran in specific edition
System.out.println(ayahFromEdition.getText());
// Get the first surah in the quaran in specific edition
Surah fistSurah = Surah.getSurah(1, edition);
System.out.println(fistSurah.getName());
// Or you can use the Surah enum to get the surah:
Surah s = Surah.getSurah(Surahs.AL_ALAQ);
System.out.println(s.getName());
}
}