Parses torgi.gov.ru and searches for new auctions. On new auction sends email notification to user.
- Parse auctions for each company via
casperjs --ignore-ssl-errors=true run.js --companyId=COMPANY_ID --categoryId=CATEGORY_ID --inn=INN
and save them to auctions/auctions_INN.json. - Save auctions from auctions folder to DB via
node save_to_db.js
. - Send email notifications for unsent emails via
node send_email.js
. - Log date and number of auctions found for each company via
node log.js
.
- Install nodejs.
- Install phantomjs globally.
- Install casperjs globally.
npm install
- Add db config file
config.js
todb/config/config.js
:
const fs = require('fs');
module.exports = {
development: {
username: 'root',
password: '',
database: 'torgi_alarm',
host: '127.0.0.1',
dialect: 'mysql'
},
test: {
username: "root",
password: null,
database: "database_test",
host: "127.0.0.1",
dialect: "mysql"
},
production: {
username: "root",
password: null,
database: "database_prod",
host: "127.0.0.1",
dialect: "mysql"
}
};
- Add
env.js
file to the root folder:
module.exports = {
EMAIL_HOST: "smtp.yandex.ru", // smtp host
EMAIL_USERNAME: "[email protected]", // from email
EMAIL_PASSWORD: "password", // from password
EMAIL_TARGET: "[email protected]" // send notifications to
};
- From
db
folder run migration via../node_modules/.bin/sequelize db:migrate
. - From
db
folder run seed script(initial data) via../node_modules/.bin/sequelize db:seed:all
.
- Add a cron job that parses all companies and saves auctions to json files
casperjs --ignore-ssl-errors=true run.js --companyId=1 --categoryId=13 --inn=2312180144 && casperjs --ignore-ssl-errors=true run.js --companyId=2 --categoryId=8 --inn=2225153948
- Add a cron job that saves auctions from json files to DB, sends emails and logs found auctions
node save_to_db.js && node send_email.js && node log.js
- Add company credentials to
Companies
DB table. - Add company and category where it posts auctions to
Targets
DB table(this step is optional but may be used in the future). - Add a new cron job that parses auctions for new company. Ex:
casperjs --ignore-ssl-errors=true run.js --companyId=3 --categoryId=13 --inn=2312195782