This is the scraper part of a service to make the information in https://free-proxy-list.net available through a REST api. The scraper requests the page every 5 minutes, parses the list of 300 available proxies and updates a REST api at https://rest-free-proxy-list.herokuapp.com/api-docs/index.html .
To retrieve the list of 300 proxies: GET https://rest-free-proxy-list.herokuapp.com/proxies
Using dep
for satisfying vendor code: $ dep init
- Go is installed
- GOPATH is set up
- Get the project:
$ go get github.com/dibusan/scrape-free-proxy-list
- Navigate to project
$ cd $GOPATH/src/github.com/dibusan/scrape-free-proxy-list
- Run main
$ go run main.go
- To check progress check the log file
tail -f /var/log/scrapefreeproxylist.log
(https://jonathanmh.com/deploying-go-apps-systemd-10-minutes-without-docker/)
-
Install go
$ sudo apt-get install golang-go
-
Setup $GOPATH
$ mkdir ~/go
-
Add to
~/.bashrc
export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin
-
Reload bashrc
$ source ~/.bashrc
-
Download code using
$ go get github.com/dibusan/scrape-free-proxy-list
-
Copy Service file to Systemd
$ cp $GOPATH/src/github.com/dibusan/scrape-free-proxy-list/daemon/scrapefreeproxylist.service /lib/systemd/system/.
-
Update
/lib/systemd/system/scrapefreeproxylist.service
lineExecStart=/home/{username}/go/src/github.com/dibusan/scrape-free-proxy-list
to reflect the correct {username} -
Reload systemctl daemon
$ sudo systemctl daemon-reload
-
Start the Service
$ service scrapefreeproxylist start
-
Enable Service on startup
$ service scrapefreeproxylist enable
-
Check status of service
$ service scrapefreeproxylist status
-
Check the logs
$ tail -f /var/log/scrapefreeproxylist.log
-
Troubleshooting
-
Error: service scrapefreeproxylist start reports an Exit Code 203
Solution: ensure systemctl is running
service scrapefreeproxylist start
with correctuser:group
for/var/log
-