Compare commits

..

No commits in common. "68903176b1597743470abd55798062e7710b54f2" and "6574c0236911191a6c0cf954ebc7ea3976632c6b" have entirely different histories.

5 changed files with 6 additions and 26 deletions

4
.env
View File

@ -1,4 +0,0 @@
RAKUTENID="<your rakuten id>"
RAKUTENPW="<your rakuten passwd>"
RCH_WATCH_TIME=7200
RCH_WATCH_NUM=5

1
.gitignore vendored
View File

@ -1 +0,0 @@
.env

View File

@ -1,15 +0,0 @@
### 動作環境
以下の環境で動作確認してます。
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`の中に実行中のスクリーンショットが吐かれるようになってます。

View File

@ -11,8 +11,8 @@ import time,os
profile_dir = "/tmp/profile"
username = os.environ["RAKUTENID"]
password = os.environ["RAKUTENPW"]
rch_time = int(os.environ["RCH_WATCH_TIME"])
rch_num = int(os.environ["RCH_WATCH_NUM"])
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"]'
@ -105,7 +105,6 @@ def watching_rch():
time.sleep(10)
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()
@ -121,5 +120,5 @@ def main():
watching_rch()
if __name__ == '__main__':
time.sleep(60) # selniumコンテナの起動を待つ待機
time.sleep(120) # selniumコンテナの起動を待つ待機
main()

View File

@ -7,6 +7,7 @@ services:
volumes:
- /dev/shm:/dev/shm
python3:
restart: always
build: ./python3
container_name: 'rpoint-getter'
working_dir: '/var/app'
@ -15,7 +16,7 @@ services:
- RAKUTENID=${RAKUTENID}
- RAKUTENPW=${RAKUTENPW}
- RCH_WATCH_TIME=${RCH_WATCH_TIME}
- RCH_WATCH_NUM=${RCH_WATCH_NUM}
- RCH_WATCH_NUM=${RCH_WATCH_TIME}
volumes:
- ./app:/var/app
depends_on: