How to run a Scrapy web scraping project in a virtual environment every day and scrape results to a database. (I use postgres, but same concept applies whichever database you use).
⦾ Create a bash script to activate virtual environment and run spider via CRON.
🌏 https://github.com/RGGH/Scrapy19
--
#!/usr/bin/env bash
source /home/pi/Documents/Scrape/bin/activate
cd /home/pi/Documents/Scrape/Scrapy19/jobz/spiders
scrapy crawl jobzspider
--
⦾ Schedule in CRON
For example, you can run a backup of all your user accounts
at 5 a.m every week with:
0 15 * * * ~/Documents/Scrape/Scrapy19/jobz/spiders/cj.sh
#
For more information see the manual pages of crontab(5) and cron(8)
#
m h dom mon dow command
--
⦾ OUTPUT 3 days later...
jobs=# select posted from listings group by 1;
posted
------------
2021-06-04
2021-06-05
2021-06-06
(3 rows)***
Visit redandgreen blog for more Tutorials
=========================================
🌏 http://redandgreen.co.uk/about/blog/
Subscribe to the YouTube Channel
=================================
🌏 / drpicode
Follow on Twitter - to get notified of new videos
=================================================
🌏 / rngweb
👍 Become a patron 👍
🌏 / drpi
Buy Dr Pi a coffee (or Tea)
☕ https://www.buymeacoffee.com/DrPi
Proxies
=================================================
If you need a good, easy to use proxy, I was recommended this one, and having used ScraperAPI for a while I can vouch for them. If you were going to sign up anyway, then maybe you would be kind enough to use the link and the coupon code below?
You can also do a full working trial first as well, (unlike some other companies). The trial doesn't ask for any payment details either so all good! 👍
🌏 10% off ScraperAPI : https://www.scraperapi.com?fpr=ken49
◼️ Coupon Code: DRPI10
(You can also get started with 1000 free API calls. No credit card required.)
❀ Thumbs up yeah? (cos Algos..)
#webscraping #scrapy #python
Watch video Web scraping | Scrapy Cron Virtual Environment online, duration hours minute second in high quality that is uploaded to the channel Python 360 07 June 2021. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 586 times and liked it 4 visitors.