From 27b3806894fb69a056a44c7c654415c2e9d1f0ec Mon Sep 17 00:00:00 2001 From: hillerliao Date: Tue, 17 May 2022 00:52:19 +0800 Subject: [PATCH] delete promoted item from ph --- rsshub/spiders/producthunt/search.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rsshub/spiders/producthunt/search.py b/rsshub/spiders/producthunt/search.py index 5a9c7e1..67595c4 100644 --- a/rsshub/spiders/producthunt/search.py +++ b/rsshub/spiders/producthunt/search.py @@ -17,14 +17,14 @@ def parse(post): def ctx(keyword='', period=''): DEFAULT_HEADERS.update({'Referer': domain}) r_url = f'{domain}' + f'/search?q={keyword}&postedAfter={period}:days' - # print(r_url) tree = fetch(r_url,headers=DEFAULT_HEADERS) posts = tree.css('.style_layoutMain___pXHk').css('.style_px-mobile-1__DSM5j.style_px-tablet-1__R5dkv.style_pt-mobile-0__lBXpV.style_pt-desktop-6__eNi8V.style_pt-tablet-6__BJU9d.style_pt-widescreen-6__SWPD_.style_pb-mobile-7__OX0Sz.style_pb-desktop-6__EZ3zm.style_pb-tablet-6__F61Qx.style_pb-widescreen-6__UB2pW') - # print(posts) + items = list(map(parse, posts)) + items = [item for item in items if item['title']!=None] return { 'title': f'{keyword} - Producthunt', 'link': r_url, 'description': f'Producthunt - {r_url}', 'author': 'hillerliao', - 'items': list(map(parse, posts)) + 'items': items }