From b3529dd9d535fda68169481e45c4b4fdcc5d27df Mon Sep 17 00:00:00 2001 From: JJ1LFC Date: Sun, 23 Aug 2020 02:26:11 +0900 Subject: [PATCH] feat: give up using schedule --- readme.md | 9 +++++++-- requirements.txt | 1 - scrape.py | 6 +----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index f4b4cab..d55ee81 100644 --- a/readme.md +++ b/readme.md @@ -35,9 +35,14 @@ When text mode is enabled (default by `config.ini.example`), text diff of news i To disable text mode, set `textmode` in `[global]` of `config.ini` to `false`. ## run -Use screen or something to keep session. - ``` source keiojp-scraper/venv/activate.fish python3 ./scrape.py ``` + +## run regularly +Use crontab. +Designate python3 under venv. +``` +10 9,17 * * * /path/to/python3 /path/to/repo/scrape.py +``` diff --git a/requirements.txt b/requirements.txt index d1c0d8d..038a3f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,5 @@ chromedriver-binary==83.0.4103.39.0 configparser==5.0.0 idna==2.9 requests==2.23.0 -schedule==0.6.0 selenium==3.141.0 urllib3==1.25.9 diff --git a/scrape.py b/scrape.py index 4fc2455..ae2f8d4 100644 --- a/scrape.py +++ b/scrape.py @@ -7,7 +7,6 @@ import chromedriver_binary import os import requests -import schedule import copy import re import json @@ -191,7 +190,4 @@ def main(): os.remove(pngFile) -schedule.every().hour.at(':10').do(main) -while True: - schedule.run_pending() - time.sleep(1) +main()