From 6574c0236911191a6c0cf954ebc7ea3976632c6b Mon Sep 17 00:00:00 2001 From: root Date: Wed, 31 May 2023 13:08:02 +0900 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E6=A9=9F=E6=99=82=E9=96=93=E3=80=81?= =?UTF-8?q?=E8=A6=96=E8=81=B4=E3=83=81=E3=83=A3=E3=83=B3=E3=83=8D=E3=83=AB?= =?UTF-8?q?=E6=95=B0=E3=82=92=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 8 +++++--- docker-compose.yml | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 3b1f2e5..bb21f3c 100644 --- a/app/main.py +++ b/app/main.py @@ -11,7 +11,8 @@ import time,os profile_dir = "/tmp/profile" username = os.environ["RAKUTENID"] password = os.environ["RAKUTENPW"] -waittime = 10 +rch_time = os.environ["RCH_WATCH_TIME"] +rch_num = os.environ["RCH_WATCH_NUM"] target_url = "https://channel.rakuten.co.jp/" welcome_btn_css = 'button[data-ratid="welcome_pg1_ok"]' login_btn_css = 'button[data-ratid="login_button"]' @@ -103,13 +104,13 @@ def watching_rch(): # 10秒待機 time.sleep(10) - for i in range(0,8): + for i in range(0,rch_num): channel_btns = driver.find_elements(By.CSS_SELECTOR, channel_btn_css) channel_btn = channel_btns[i] channel_btn.click() time.sleep(10) driver.save_screenshot('./ss/channel_' + str(i) + '.png') - time.sleep(waittime) + time.sleep(rch_time) driver.quit() @@ -119,4 +120,5 @@ def main(): watching_rch() if __name__ == '__main__': + time.sleep(120) # selniumコンテナの起動を待つ待機 main() \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b3ae5c1..29784f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,8 @@ services: environment: - RAKUTENID=${RAKUTENID} - RAKUTENPW=${RAKUTENPW} + - RCH_WATCH_TIME=${RCH_WATCH_TIME} + - RCH_WATCH_NUM=${RCH_WATCH_TIME} volumes: - ./app:/var/app depends_on: