The project is a web scraper that searches for information and images of GTA V vehicles, the script can be modified to search in other web sources.
# To build the typescript project
npm run build
# To run the builded scraper
npm run start
All filters must be defined in the /src/index.ts
file, instructions below.
The first parameter in the scraper.start()
method is the search source (required), you can choose and implement other options.
Sources:
const scraper = new Scraper();
await scraper.init();
const result = await scraper.start('wiki-rage');
The second parameter in the scraper.start()
method is the vehicle categories to be excluded (optional), you must define a string array that contains all the categories that you want to exclude.
Click here to view vehicle categories
const scraper = new Scraper();
await scraper.init();
const result = await scraper.start(
'wiki-rage',
[
'boats',
'helicopters',
'industrial',
'planes',
'service',
'trailer',
'trains'
]
);
The last parameter in the scraper.start()
method is the vehicles to be excluded from the search (optional), you must define a string array that contains all the vehicles that you want to exclude.
const scraper = new Scraper();
await scraper.init();
const result = await scraper.start(
'wiki-rage', [], ['benson', 'biff', 'cerberus', 'cerberus2']
);
All scraped data will be created in
/build/result
(production)
/src/result
(development)
📁 result
╠ 📁 images
╚ 📄 result.json
It's the file with all the vehicles data separated by category
{
"commercials": [
{
"vehicle_name": 'benson',
"thumbnail_url": 'https://wiki.rage.mp/images/thumb/b/bd/Benson.png/164px-Benson.png',
}
// ... other vehicles objects
],
"compacts": [...],
"coupes": [...],
"cycles": [...],
"military": [...],
// ... other categories
}
It's the folder where all images of the vehicle will be stored.