Compare commits
6 Commits
5035240ada
...
68903176b1
Author | SHA1 | Date |
---|---|---|
|
68903176b1 | |
|
12160ca37b | |
|
485ae59d4f | |
|
d06ef017ad | |
|
c0491cff9e | |
|
6574c02369 |
|
@ -0,0 +1,4 @@
|
||||||
|
RAKUTENID="<your rakuten id>"
|
||||||
|
RAKUTENPW="<your rakuten passwd>"
|
||||||
|
RCH_WATCH_TIME=7200
|
||||||
|
RCH_WATCH_NUM=5
|
|
@ -0,0 +1 @@
|
||||||
|
.env
|
|
@ -0,0 +1,15 @@
|
||||||
|
### 動作環境
|
||||||
|
以下の環境で動作確認してます。
|
||||||
|
CentOS7 + docker 20.10.6 + Docker-Compose 1.29.1
|
||||||
|
|
||||||
|
docker(+docker-compose)さえ入ってれば、どこでも動作するはず。
|
||||||
|
|
||||||
|
### 使用方法
|
||||||
|
1. `.env`ファイルの`RAKUTENID`、`RAKUTENPW`を任意の値へ変更
|
||||||
|
※`RCH_WATCH_TIME`と`RCH_WATCH_NUM`は視聴時間・視聴チャンネル数の設定を変更する場合に利用
|
||||||
|
|
||||||
|
2. `docker-compose`を利用してコンテナを実行
|
||||||
|
コマンド例:```/usr/local/bin/docker-compose up --abort-on-container-exit```
|
||||||
|
|
||||||
|
### 補足
|
||||||
|
実際に動いているか不安なので`./app/ss`の中に実行中のスクリーンショットが吐かれるようになってます。
|
|
@ -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 = int(os.environ["RCH_WATCH_TIME"])
|
||||||
|
rch_num = int(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,14 @@ def watching_rch():
|
||||||
# 10秒待機
|
# 10秒待機
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
for i in range(0,8):
|
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_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 +121,5 @@ def main():
|
||||||
watching_rch()
|
watching_rch()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
time.sleep(60) # selniumコンテナの起動を待つ待機
|
||||||
main()
|
main()
|
|
@ -7,7 +7,6 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- /dev/shm:/dev/shm
|
- /dev/shm:/dev/shm
|
||||||
python3:
|
python3:
|
||||||
restart: always
|
|
||||||
build: ./python3
|
build: ./python3
|
||||||
container_name: 'rpoint-getter'
|
container_name: 'rpoint-getter'
|
||||||
working_dir: '/var/app'
|
working_dir: '/var/app'
|
||||||
|
@ -15,6 +14,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- RAKUTENID=${RAKUTENID}
|
- RAKUTENID=${RAKUTENID}
|
||||||
- RAKUTENPW=${RAKUTENPW}
|
- RAKUTENPW=${RAKUTENPW}
|
||||||
|
- RCH_WATCH_TIME=${RCH_WATCH_TIME}
|
||||||
|
- RCH_WATCH_NUM=${RCH_WATCH_NUM}
|
||||||
volumes:
|
volumes:
|
||||||
- ./app:/var/app
|
- ./app:/var/app
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
Loading…
Reference in New Issue