File size: 1,360 Bytes
3c6e2f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
import urllib.request
import json

sys.stdout.reconfigure(encoding='utf-8')

collections = {
    'Maududi_Urdu': 'Tafheem-ul-Quran-by-Syed-Abul-Ala-Moududi-Audio-MP3-CD',
    'Maududi_English': 'Towards-Understanding-the-Quran-Abridged-Version-Of-Tafhim-Al-Quran-Audio-Mp3',
    'Saadi_Arabic': 'Tafseer_Al-Saadi_mp3',
    'Ibn_Kathir_Urdu': 'Tafsir-ibne-kaseer-kathir-urdu-----audio-mp3-hq',
    'Dr_Israr_Urdu': 'BayanUlQuranInUrduByDr.IsrarAhmedAudioMP3-HQ',
    'Dr_Israr_English': 'Bayan-ul-Quran-in-English-by-Dr-Israr-Ahmed-Audio-MP3-CD',
}

for name, coll in collections.items():
    meta_url = f"https://archive.org/metadata/{coll}/files"
    try:
        req = urllib.request.Request(meta_url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'})
        with urllib.request.urlopen(req, timeout=10) as r:
            data = json.loads(r.read())
            files = [f['name'] for f in data.get('result', []) if f['name'].endswith('.mp3')]
            print(f"=== {name} ({coll}) ===")
            print(f"Total MP3s: {len(files)}")
            # print first 3 and last 3
            for f in files[:3]:
                print(f"  {f}")
            if len(files) > 3:
                for f in files[-3:]:
                    print(f"  {f}")
            print()
    except Exception as e:
        print(f"{name}: Error {e}")