待機時間、視聴チャンネル数を環境変数化
parent
5035240ada
commit
6574c02369
|
@ -11,7 +11,8 @@ import time,os
|
||||||
profile_dir = "/tmp/profile"
|
profile_dir = "/tmp/profile"
|
||||||
username = os.environ["RAKUTENID"]
|
username = os.environ["RAKUTENID"]
|
||||||
password = os.environ["RAKUTENPW"]
|
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/"
|
target_url = "https://channel.rakuten.co.jp/"
|
||||||
welcome_btn_css = 'button[data-ratid="welcome_pg1_ok"]'
|
welcome_btn_css = 'button[data-ratid="welcome_pg1_ok"]'
|
||||||
login_btn_css = 'button[data-ratid="login_button"]'
|
login_btn_css = 'button[data-ratid="login_button"]'
|
||||||
|
@ -103,13 +104,13 @@ def watching_rch():
|
||||||
# 10秒待機
|
# 10秒待機
|
||||||
time.sleep(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_btns = driver.find_elements(By.CSS_SELECTOR, channel_btn_css)
|
||||||
channel_btn = channel_btns[i]
|
channel_btn = channel_btns[i]
|
||||||
channel_btn.click()
|
channel_btn.click()
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
driver.save_screenshot('./ss/channel_' + str(i) + '.png')
|
driver.save_screenshot('./ss/channel_' + str(i) + '.png')
|
||||||
time.sleep(waittime)
|
time.sleep(rch_time)
|
||||||
|
|
||||||
driver.quit()
|
driver.quit()
|
||||||
|
|
||||||
|
@ -119,4 +120,5 @@ def main():
|
||||||
watching_rch()
|
watching_rch()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
time.sleep(120) # selniumコンテナの起動を待つ待機
|
||||||
main()
|
main()
|
|
@ -15,6 +15,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- RAKUTENID=${RAKUTENID}
|
- RAKUTENID=${RAKUTENID}
|
||||||
- RAKUTENPW=${RAKUTENPW}
|
- RAKUTENPW=${RAKUTENPW}
|
||||||
|
- RCH_WATCH_TIME=${RCH_WATCH_TIME}
|
||||||
|
- RCH_WATCH_NUM=${RCH_WATCH_TIME}
|
||||||
volumes:
|
volumes:
|
||||||
- ./app:/var/app
|
- ./app:/var/app
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
Loading…
Reference in New Issue