DeviceInfo is a utility for fetching and displaying device brand/model. It uses DeviceSpecifications to fetch the information based on provided model code(s). Can also use a Google Programmable Search Engine when device is not found using DeviceSpecifications.
Data is cached (enabled by default) so it doesn't query the APIs if code/device is cached.
Ensure you have Node.js and npm installed before setting up DeviceInfo.
-
Node.js (which includes npm) installed on your system.
-
Google Programmable Search Engine setup (not required, disabled by default)
For better results, this application can use a Google Programmable Search Engine. Read more.
- Clone the repository to your local machine:
git clone https://github.com/joaocjesus/deviceInfo.git
- Install the necessary npm packages:
npm install
- Check/modify configuration options in in
config/config.ts
- Set environment variables in
.env
:
- Rename
.env.example
to.env
- Set
API_KEY
andCUSTOM_SEARCH_ID
variablesAPI_KEY
: Your Google Custom Search API keyCUSTOM_SEARCH_ID
: The Search Engine ID
DeviceInfo can be used either by providing a single model code via the command line or by passing a text file containing a list of model codes.
For the available parameters, run from command-line:
npm run usage
If query returns error 429, it might mean the search query allowance has been surpassed (free tier = 100 requests per day) or requests are being made too fast. Run it with caching set to true and retry (wait between retries and it will keep adding the values).
Google is offering a good amount of credits for free if you setup billing (at the time of writing)
I've used several ways to try and find the device based on the manufacturer model code, but some codes are harder to find, specially for less known brands. If you find a device manually, you can add it to the cache file, so it uses that match when running DeviceInfo.
I've attempted to make it as precise as possible (around 99% based on my testing with over 700+ model codes), but some errors might happen. Open to suggestions.
Email: johncjesus@gmail.com
GitHub: https://github.com/joaocjesus