Skip to content

Commit

Permalink
更新登录组件
Browse files Browse the repository at this point in the history
  • Loading branch information
Hsury committed Dec 22, 2019
1 parent 6e7d31e commit d528791
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if: 'tag IS blank'
env:
global:
- TRAVIS_TAG=v2.0
- TRAVIS_TAG=v2.1
jobs:
include:
-
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h1 align="center">- Bilibili Toolkit -</h1>

<p align="center">
<img src="https://img.shields.io/badge/version-2019.12.6-green.svg?longCache=true&style=for-the-badge">
<img src="https://img.shields.io/badge/version-2019.12.22-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>
Expand All @@ -20,7 +20,7 @@

|组件 |版本 |描述 |
|--------------------|---------------|------------------------------|
|login |2019/12/6 |登录 |
|login |2019/12/22 |登录 |
|get_user_info |2019/9/15 |获取用户信息 |
|set_privacy |2018/7/24 |修改隐私设置 |
|silver_to_coin |2018/8/8 |银瓜子兑换硬币 |
Expand Down
6 changes: 3 additions & 3 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.12.6"
__version__ = "2019.12.22"

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/78.0.3904.108 Safari/537.36"})
self._session.headers.update({'User-Agent': "Mozilla/5.0 BiliDroid/5.51.1 (bbcallen@gmail.com)"})
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 @@ -208,7 +208,7 @@ def get_key():
while True:
key = get_key()
key_hash, pub_key = key['key_hash'], key['pub_key']
url = f"{self.protocol}://passport.bilibili.com/api/v3/oauth2/login"
url = f"{self.protocol}://passport.bilibili.com/api/v2/oauth2/login"
param = f"appkey={Bilibili.app_key}&password={parse.quote_plus(base64.b64encode(rsa.encrypt(f'{key_hash}{self.password}'.encode(), pub_key)))}&username={parse.quote_plus(self.username)}"
payload = f"{param}&sign={self.calc_sign(param)}"
headers = {'Content-type': "application/x-www-form-urlencoded"}
Expand Down

0 comments on commit d528791

Please sign in to comment.