環境変数がstrで取得されるのでint()を追加

develop
root 2023-05-31 14:46:04 +09:00
parent 485ae59d4f
commit 12160ca37b
1 changed files with 5 additions and 4 deletions

View File

@ -11,8 +11,8 @@ import time,os
profile_dir = "/tmp/profile"
username = os.environ["RAKUTENID"]
password = os.environ["RAKUTENPW"]
rch_time = os.environ["RCH_WATCH_TIME"]
rch_num = os.environ["RCH_WATCH_NUM"]
rch_time = int(os.environ["RCH_WATCH_TIME"])
rch_num = int(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"]'
@ -104,7 +104,8 @@ def watching_rch():
# 10秒待機
time.sleep(10)
for i in range(0,rch_num):
for i in range(0, rch_num):
print( str( i + 1) + "番目のチャンネルの視聴を始めます。視聴時間は" + str(rch_time) + "秒に設定されています。")
channel_btns = driver.find_elements(By.CSS_SELECTOR, channel_btn_css)
channel_btn = channel_btns[i]
channel_btn.click()
@ -120,5 +121,5 @@ def main():
watching_rch()
if __name__ == '__main__':
time.sleep(120) # selniumコンテナの起動を待つ待機
time.sleep(60) # selniumコンテナの起動を待つ待機
main()