-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
if: 'tag IS blank' | ||
env: | ||
global: | ||
- TRAVIS_TAG=v2.1 | ||
- TRAVIS_TAG=v2.2 | ||
jobs: | ||
include: | ||
- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ | |
__author__ = "Hsury" | ||
__email__ = "[email protected]" | ||
__license__ = "SATA" | ||
__version__ = "2019.12.22" | ||
__version__ = "2020.7.2" | ||
|
||
class Bilibili: | ||
app_key = "1d8b6e7d45233436" | ||
|
@@ -579,6 +579,28 @@ def follow(self, mid, secret=False): | |
self._log(f"用户{mid}{'悄悄' if secret else ''}关注失败 {response}") | ||
return False | ||
|
||
# 批量关注 | ||
def follow_batch(self, mids): | ||
# mids = 被关注用户UID | ||
url = f"{self.protocol}://api.bilibili.com/x/relation/batch/modify" | ||
payload = { | ||
'fids': ",".join(map(str, mids)), | ||
'act': 1, | ||
'csrf': self.get_csrf(), | ||
're_src': 222, | ||
} | ||
headers = { | ||
'Host': "api.bilibili.com", | ||
'Referer': "https://www.bilibili.com/blackboard/live/activity-NfUS01P8.html", | ||
} | ||
response = self._requests("post", url, data=payload, headers=headers) | ||
if response and response.get("code") == 0: | ||
self._log(f"用户{', '.join(map(str, mids))}批量关注成功") | ||
return True | ||
else: | ||
self._log(f"用户{', '.join(map(str, mids))}批量关注失败 {response}") | ||
return False | ||
|
||
# 弹幕发送 | ||
def danmaku_post(self, aid, message, page=1, moment=-1): | ||
# aid = 稿件av号 | ||
|
@@ -1384,6 +1406,8 @@ def delay_wrapper(func, interval, arg_list=[()], shuffle=False): | |
threads.append(threading.Thread(target=delay_wrapper, args=(instance.share, 5, list(zip(config['share']['aid']))))) | ||
if config['follow']['enable']: | ||
threads.append(threading.Thread(target=delay_wrapper, args=(instance.follow, 5, list(zip(config['follow']['mid'], config['follow']['secret']))))) | ||
if config['follow_batch']['enable']: | ||
threads.append(threading.Thread(target=delay_wrapper, args=(instance.follow_batch, 5, list((config['follow_batch']['mid'][i:i + 50],) for i in range(0, len(config['follow_batch']['mid']), 50))))) | ||
if config['danmaku_post']['enable']: | ||
threads.append(threading.Thread(target=delay_wrapper, args=(instance.danmaku_post, 5, list(zip(config['danmaku_post']['aid'], config['danmaku_post']['message'], config['danmaku_post']['page'], config['danmaku_post']['moment']))))) | ||
if config['comment_like']['enable']: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters