Collects news with news api and stores it in a mysql/mariadb database.
- Initialize a database with the table listed in
init.sql
. - Copy config.example.yaml to config.yaml and change it's values..
- Build with
go build ./cmd/news/main.go
ormake build-all
- Run the executable with flag
-c <CONFIG.YAML PATH>
in order to scrap the data.
- Install a crontab implementation such as
cronie
. make install
or make sure you know the path to your exectuable.- Make sure you know the path of your
config.yaml
. - Run
crontab -e
- Paste this
0 */2 * * * /usr/bin/news-scrap -c /home/daysling/.news.yaml
(Change the config file path and you are good to go!)