mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 23:16:50 +00:00
add pgyer
This commit is contained in:
@@ -195,6 +195,10 @@ def producthunt_search(keyword='', period=''):
|
|||||||
from rsshub.spiders.producthunt.search import ctx
|
from rsshub.spiders.producthunt.search import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(keyword,period)))
|
return render_template('main/atom.xml', **filter_content(ctx(keyword,period)))
|
||||||
|
|
||||||
|
@bp.route('/pgyer/<string:category>')
|
||||||
|
def pgyer_app(category=''):
|
||||||
|
from rsshub.spiders.pgyer.app import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
@bp.route('/mp/gh/<string:gh>')
|
@bp.route('/mp/gh/<string:gh>')
|
||||||
def mp_gh(gh=''):
|
def mp_gh(gh=''):
|
||||||
|
|||||||
28
rsshub/spiders/pgyer/app.py
Normal file
28
rsshub/spiders/pgyer/app.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
from rsshub.utils import fetch
|
||||||
|
|
||||||
|
domain = 'https://www.pgyer.com'
|
||||||
|
|
||||||
|
def ctx(category=''):
|
||||||
|
url = f"{domain}/{category}"
|
||||||
|
tree = fetch(url,headers=DEFAULT_HEADERS)
|
||||||
|
posts = tree.css('.container.content.pt-10')
|
||||||
|
posts = tree.css('html')
|
||||||
|
title = tree.xpath('//meta[@property="og:description"]').attrib['content']
|
||||||
|
app_name = tree.css('title::text').get()
|
||||||
|
return {
|
||||||
|
'title': f'{title} - 蒲公英',
|
||||||
|
'link': url,
|
||||||
|
'description': f'{app_name} 安装包更新 - 蒲公英',
|
||||||
|
'author': 'hillerliao',
|
||||||
|
'items': list(map(parse, posts))
|
||||||
|
}
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
item['title'] = post.xpath('//meta[@property="og:description"]').attrib['content']
|
||||||
|
item['description'] = item['title'] + ';' \
|
||||||
|
+ post.css('ul.breadcrumb > li::text').getall()[1] + ';' \
|
||||||
|
+ post.css('ul.breadcrumb > li::text').getall()[2]
|
||||||
|
item['link'] = post.css('img.qrcode').attrib['src']
|
||||||
|
return item
|
||||||
Reference in New Issue
Block a user