mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-17 07:26:49 +00:00
mp status from sogou
This commit is contained in:
@@ -169,7 +169,13 @@ def chouti_section(category=''):
|
|||||||
def chouti_search(category=''):
|
def chouti_search(category=''):
|
||||||
from rsshub.spiders.chouti.search import ctx
|
from rsshub.spiders.chouti.search import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
@bp.route('/mp/tag/<string:mp>/<string:tag>')
|
@bp.route('/mp/tag/<string:mp>/<string:tag>')
|
||||||
def mp_tag(mp='', tag=''):
|
def mp_tag(mp='', tag=''):
|
||||||
from rsshub.spiders.mp.tag import ctx
|
from rsshub.spiders.mp.tag import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(mp,tag)))
|
return render_template('main/atom.xml', **filter_content(ctx(mp,tag)))
|
||||||
|
|
||||||
|
@bp.route('/mp/gh/<string:gh>')
|
||||||
|
def mp_gh(gh=''):
|
||||||
|
from rsshub.spiders.mp.gh import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(gh)))
|
||||||
32
rsshub/spiders/mp/gh.py
Normal file
32
rsshub/spiders/mp/gh.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
from rsshub.utils import fetch
|
||||||
|
|
||||||
|
domain = 'https://weixin.sogou.com'
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
|
||||||
|
if dd_num > 1:
|
||||||
|
item['description'] = item['title'] = post.css('a::text').get()
|
||||||
|
item['link'] = domain + post.css('a::attr(href)').get()
|
||||||
|
item['pubDate'] = post.css('script::text').get().split('\'')[-2]
|
||||||
|
else:
|
||||||
|
item['description'] = item['title'] = '近期没有新文章'
|
||||||
|
item['link'] = url
|
||||||
|
return item
|
||||||
|
|
||||||
|
def ctx(gh=''):
|
||||||
|
global url
|
||||||
|
url = f"{domain}/weixin?query={gh}"
|
||||||
|
tree = fetch(url)
|
||||||
|
global dd_num
|
||||||
|
dd_num = len( tree.css('dd') )
|
||||||
|
posts = [ tree.css('dd')[-1] ]
|
||||||
|
mp_name = tree.css('p.tit a::text').get()
|
||||||
|
mp_description = tree.css('dd::text')[0].get()
|
||||||
|
return {
|
||||||
|
'title': f'{mp_name}-公众号',
|
||||||
|
'link': url,
|
||||||
|
'description': mp_description,
|
||||||
|
'author': 'hillerliao',
|
||||||
|
'items': list(map(parse, posts))
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<language>zh-cn</language>
|
<language>zh-cn</language>
|
||||||
<id>{{link}}</id>
|
<id>{{link}}</id>
|
||||||
<title><![CDATA[{{title|safe}}]]></title>
|
<title><![CDATA[{{title|safe}}]]></title>
|
||||||
|
<description> <![CDATA[{{description|safe}}]]> </description>
|
||||||
<link href="{{link}}"/>
|
<link href="{{link}}"/>
|
||||||
<author>
|
<author>
|
||||||
<name><![CDATA[{{author|safe}}]]></name>
|
<name><![CDATA[{{author|safe}}]]></name>
|
||||||
|
|||||||
Reference in New Issue
Block a user