support wechat

This commit is contained in:
felinae98 2021-02-27 14:03:46 +08:00
parent ed163cc842
commit d56c608dd7
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610
3 changed files with 9 additions and 2 deletions

View File

@ -45,7 +45,8 @@ class Wechat(Platform):
post = { post = {
'title': last_post_dt.find_parent().find('a').text, 'title': last_post_dt.find_parent().find('a').text,
'target': target, 'target': target,
'page_url': self._get_query_url(target) 'page_url': self._get_query_url(target),
'name': block.find('p', class_='tit').find('a').text
} }
return [post] return [post]
else: else:
@ -67,6 +68,7 @@ class Wechat(Platform):
# TODO get content of post # TODO get content of post
return Post(target_type='wechat', return Post(target_type='wechat',
text='{}\n详细内容请自行查看公众号'.format(raw_post['title']), text='{}\n详细内容请自行查看公众号'.format(raw_post['title']),
target_name=raw_post['name'],
pics=[], pics=[],
url='' url=''
) )

View File

@ -18,6 +18,11 @@ async def bilibili_check():
async def rss_check(): async def rss_check():
await fetch_and_send('rss') await fetch_and_send('rss')
@scheduler.scheduled_job('interval', seconds=30)
async def wechat_check():
await fetch_and_send('wechat')
@scheduler.scheduled_job('interval', seconds=1) @scheduler.scheduled_job('interval', seconds=1)
async def _(): async def _():
await do_send_msgs() await do_send_msgs()

View File

@ -20,7 +20,7 @@ class Singleton(type):
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls] return cls._instances[cls]
supported_target_type = ('weibo', 'bilibili', 'rss') supported_target_type = ('weibo', 'bilibili', 'rss', 'wechat')
if not plugin_config.hk_reporter_use_local and not check_chromium(): if not plugin_config.hk_reporter_use_local and not check_chromium():
os.environ['PYPPETEER_DOWNLOAD_HOST'] = 'http://npm.taobao.org/mirrors' os.environ['PYPPETEER_DOWNLOAD_HOST'] = 'http://npm.taobao.org/mirrors'