Skip to content

Commit

Permalink
接入Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Hsury committed Nov 30, 2019
1 parent 58d10df commit 8a970cb
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 7 deletions.
52 changes: 52 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
if: 'tag IS blank'
env:
global:
- TRAVIS_TAG=v1.9
jobs:
include:
-
name: 'Python 3.7.5 on Linux (AMD64)'
os: linux
dist: bionic
arch: amd64
language: python
python: 3.7.5
env: RELEASE_FILENAME=bilibili-toolkit-$TRAVIS_TAG-linux-amd64.tar.gz
-
name: 'Python 3.7.5 on Linux (ARM64)'
os: linux
dist: bionic
arch: arm64
language: python
python: 3.7.5
env: ['PATH=~/.ruby/bin:$PATH', GEM_HOME=~/.ruby, RELEASE_FILENAME=bilibili-toolkit-$TRAVIS_TAG-linux-arm64.tar.gz]
-
name: 'Python 3.7.4 on macOS (AMD64)'
os: osx
osx_image: xcode11.2
arch: amd64
language: shell
env: RELEASE_FILENAME=bilibili-toolkit-$TRAVIS_TAG-macos-amd64.zip
-
name: 'Python 3.7.5 on Windows (AMD64)'
os: windows
arch: amd64
language: shell
env: ['PATH=/c/Python37:/c/Python37/Scripts:$PATH', RELEASE_FILENAME=bilibili-toolkit-$TRAVIS_TAG-windows-amd64.zip]
before_install: 'choco install python --version 3.7.5'
install:
- 'if [ "$TRAVIS_OS_NAME" = "windows" ]; then python -m pip install -U pip; else pip3 install -U pip; fi'
- 'pip3 install -r requirements.txt'
- 'pip3 install pyinstaller'
script:
- 'pyinstaller -F -i icon.ico bilibili.py'
- 'mkdir -p release/Bilibili-Toolkit'
- 'cp {dist/*,config.toml,LICENSE,proxy.txt,README.md} release/Bilibili-Toolkit'
- 'cd release'
- 'if [ "$TRAVIS_OS_NAME" = "windows" ]; then 7z a -tzip $RELEASE_FILENAME Bilibili-Toolkit; elif [ "$TRAVIS_OS_NAME" = "osx" ]; then zip -r $RELEASE_FILENAME Bilibili-Toolkit; else tar -czvf $RELEASE_FILENAME Bilibili-Toolkit; fi'
deploy:
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
file: $RELEASE_FILENAME
overwrite: true
skip_cleanup: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Ruoyang Xu
Copyright (c) 2018-2019 Hsury

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
<h1 align="center">- Bilibili Toolkit -</h1>

<p align="center">
<img src="https://img.shields.io/badge/version-2019.9.15-green.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/version-2019.11.30-green.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/license-SATA-blue.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/travis/com/Hsury/Bilibili-Toolkit?style=for-the-badge">
</p>

<h4 align="center">🛠️ 哔哩哔哩(B站)辅助工具箱,支持Cookie/Token/Password融合持久化登录与多用户操作</h4>
Expand Down Expand Up @@ -59,7 +60,7 @@ nano config.toml
2. 安装Python 3.6/3.7,并使用pip安装依赖

```
pip install -r requirements.txt -U
pip install -r requirements.txt -U -i https://pypi.tuna.tsinghua.edu.cn/simple
```

3. 启动脚本
Expand Down
8 changes: 4 additions & 4 deletions bilibili.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
__author__ = "Hsury"
__email__ = "i@hsury.com"
__license__ = "SATA"
__version__ = "2019.9.15"
__version__ = "2019.11.30"

class Bilibili:
app_key = "1d8b6e7d45233436"
Expand All @@ -65,7 +65,7 @@ class Bilibili:

def __init__(self, https=True, queue=None):
self._session = requests.Session()
self._session.headers.update({'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36"})
self._session.headers.update({'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"})
self.__queue = queue
self.get_cookies = lambda: self._session.cookies.get_dict(domain=".bilibili.com")
self.get_csrf = lambda: self.get_cookies().get("bili_jct", "")
Expand Down Expand Up @@ -1471,9 +1471,9 @@ def main():
os.system(f"{prefix}yum -y install chromedriver")
elif platform.system() == "Windows":
if not os.path.exists("chrome-win\\chrome.exe"):
decompress(download("https://npm.taobao.org/mirrors/chromium-browser-snapshots/Win/686378/chrome-win.zip"))
decompress(download("https://npm.taobao.org/mirrors/chromium-browser-snapshots/Win/706915/chrome-win.zip"))
if not os.path.exists("chromedriver.exe"):
decompress(download("https://npm.taobao.org/mirrors/chromedriver/78.0.3904.11/chromedriver_win32.zip"))
decompress(download("https://npm.taobao.org/mirrors/chromedriver/79.0.3945.36/chromedriver_win32.zip"))
else:
print("会员购抢购组件不支持在当前平台上运行")
config['mall_rush']['enable'] = False
Expand Down
Binary file added icon.ico
Binary file not shown.

0 comments on commit 8a970cb

Please sign in to comment.