diff --git a/bilibili/assign_up.ini.tmp b/bilibili/assign_up.ini.tmp index 6de8eae..94f839b 100644 --- a/bilibili/assign_up.ini.tmp +++ b/bilibili/assign_up.ini.tmp @@ -8,5 +8,7 @@ tid:126 view_abnormal:1000 [assign] av_ids:21061574,11624347 +;split by ',' [comment] -keyword:死全家,草泥马 \ No newline at end of file +keyword:死全家|草泥马|.{0,4}\$\$_.{0,4} +;support re, use '|' split diff --git a/bilibili/bilibili.py b/bilibili/bilibili.py index 130bf00..0286b37 100644 --- a/bilibili/bilibili.py +++ b/bilibili/bilibili.py @@ -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 @@ -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' @@ -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) @@ -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) @@ -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(