Skip to content

abbas-bachari/FoneDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 FoneDB

Python License Downloads

🛠️ Version 1.0.0

🌟 Introduction

FoneDB A simple script to scrape and collect smartphone specifications from PhoneDB automatically..


📚 Requirements

  • Python 3.8+
  • DBFlux>= 1.0.2

🔧 Installation

install from source:

git clone https://github.com/abbas-bachari/fonedb.git
cd fonedb
pip install .

💡 Quick Start

from fonedb import FoneDB,Storage,Device


DB= Storage(base_db=Sqlite(db_name="phones.db"))

async def scrape():
    fone_db = FoneDB(r'Certificates/RapidSSL_TLS_RSA_CA_G1.crt',database=DB)
    brands=["Samsung","Xiaomi"]
    try:
        for brand in brands:
            await fone_db.scrape_devices(brand,from_date="2015-01-01",sleep_time=3,start_index=0)
    finally:
        await fone_db.close()
    
    print(f"✅ Total stored models: {DB.get_record_count()}")



def loade_devices():
    total=DB.get_record_count()
    total_samsung=DB.get_record_count(conditions=[Device.brand=="Samsung"])
    total_xiaomi=DB.get_record_count(conditions=[Device.brand=="Xiaomi"])
    


    print(f"✅ Total stored models: {total}")
    print(f"✅ Total stored Samsung models: {total_samsung}")
    print(f"✅ Total stored Xiaomi models: {total_xiaomi}")

    devices:list[Device]= DB.get()
    print("✅ First device:\n",  devices[0])
    


if __name__ == "__main__":
    asyncio.run(scrape())
    loade_devices()

Example Output:

...
...
Load Xiaomi page 35 of 39
Saved 15 devices ...
Load Xiaomi page 36 of 39
Saved 10 devices ...
Load Xiaomi page 37 of 39
Saved 10 devices ...
Load Xiaomi page 38 of 39
Saved 9 devices ...
Load Xiaomi page 39 of 39
Saved 2 devices ...
✅ Total stored models: 1383
✅ Total stored models: 1383
✅ Total stored Samsung models: 976
✅ Total stored Xiaomi models: 407
✅ First device:
 {
    "model": "SM-E066B/DS",
    "brand": "Samsung",
    "name": "Samsung SM-E066B/DS Galaxy F06 5G 2025 Standard Edition Global Dual Sim TD-LTE 128GB",
    "os_system": "Android",
    "os_version": "14",
    "sdk_version": 34,
    "memory": "128GB",
    "regions": "GLOBAL",
    "edition": "Standard Edition",
    "is_global": true,
    "dual_sim": true,
    "url": "https://phonedb.net/index.php?m=device&id=24739&c=samsung_sm-e066bds_galaxy_f06_5g_2025_standard_edition_global_dual_sim_td-lte_128gb__samsung_a066"
}}

📜 License

This project is licensed under the MIT License.


👤 Publisher / ناشر

Abbas Bachari / عباس بچاری


💖 Sponsor

Support development by sponsoring on Github Sponsors.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages