使用方法

  • 在Github上创建个新仓库
  • 创建 /.github/workflows/day.yml
  • 将day.yml里面的phone和password里面的xxx替换成自己的账号密码即可

创建后等待3小时,以后每3个小时脚本会自动运行一次进行检测,可以在Actions里查看运行记录

day.yml

name: 网易云音乐日推自动创建歌单

on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '0 0/3 * * *'

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: 更新为中国时间
      run: |
        sudo rm -rf /etc/localtime 
        sudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
        date
    - name: 安装网易云api
      run: git clone https://github.com/shanghaobo/NeteaseCloudMusicApi.git
    - name: 运行网易云api
      run: |
        cd NeteaseCloudMusicApi
        npm install
        nohup node app.js &
    - name: 安装并脚本
      run: git clone https://github.com/shanghaobo/NeteaseCloudMusicDay.git
    - name: 设置api
      run: echo "api='http://127.0.0.1:3000'" >> NeteaseCloudMusicDay/config.py
    - name: 设置网易云音乐登录账号
      run: echo "phone='xxxxxxxxxxx'" >> NeteaseCloudMusicDay/config.py
    - name: 设置网易云音乐登录密码
      run: echo "password='xxxxxx'" >> NeteaseCloudMusicDay/config.py
    - name: 运行脚本
      run: python3 NeteaseCloudMusicDay/main2.py

建议仓库设为私人,防止账号密码泄露