Skip to content

Commit

Permalink
🐝support re
Browse files Browse the repository at this point in the history
  • Loading branch information
iofu728 committed Apr 9, 2019
1 parent 6953236 commit 69c079e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion bilibili/assign_up.ini.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ tid:126
view_abnormal:1000
[assign]
av_ids:21061574,11624347
;split by ','
[comment]
keyword:死全家,草泥马
keyword:死全家|草泥马|.{0,4}\$\$_.{0,4}
;support re, use '|' split
12 changes: 7 additions & 5 deletions bilibili/bilibili.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@Author: gunjianpan
@Date: 2019-03-16 15:18:10
@Last Modified by: gunjianpan
@Last Modified time: 2019-04-08 00:23:03
@Last Modified time: 2019-04-09 10:26:28
'''

import codecs
Expand Down Expand Up @@ -84,7 +84,7 @@ def load_configure(self):
self.view_abnormal = cfg.getint('basic', 'view_abnormal')
self.assign_ids = [int(ii)
for ii in cfg.get('assign', 'av_ids').split(',')]
self.keyword = cfg.get('comment', 'keyword').split(',')
self.keyword = cfg.get('comment', 'keyword')
self.AV_URL = self.BASIC_AV_URL % self.basic_av_id
self.RANKING_URL = self.BASIC_RANKING_URL % self.assign_rank_id + '%d/%d'

Expand Down Expand Up @@ -400,7 +400,6 @@ def load_rank_index(self, index: int, day_index: int):
rank_map[av_id] = [rank, score, name, index, day_index]

''' check assign av rank '''
self.load_configure()
for ii in self.assign_ids:
if not ii in self.public:
wait_check_public.append(ii)
Expand Down Expand Up @@ -471,13 +470,16 @@ def load_click(self, num=1000000):
self.rank_map = {ii: [] for ii in self.assign_ids}

for index in range(num):
''' reload configure '''
self.load_configure()

threading_list = []
if not index % 5:
work = threading.Thread(target=self.load_rank, args=())
threading_list.append(work)
check = threading.Thread(target=self.get_check, args=())
threading_list.append(check)
if index % 15:
if not index % 15:
work = threading.Thread(
target=self.get_star_num, args=(self.assign_up_mid, 0, True))
threading_list.append(work)
Expand Down Expand Up @@ -614,7 +616,7 @@ def have_bad_comment(self, req_list: list, av_id: int, pn: int, parent_floor=Non
''' check comment and send warning email if error '''
floor, ctime, like, _, _, uname, sex, content, sign = req_list

if not len([0 for ii in self.keyword if ii in content]):
if not len(re.findall(self.keyword, content)):
return True

floor = str(
Expand Down

0 comments on commit 69c079e

Please sign in to comment.