change source address for businesswire

This commit is contained in:
hillerliao
2020-03-14 07:37:43 +08:00
parent 4ff05e34fe
commit 7569e39a82

View File

@@ -1,25 +1,28 @@
from rsshub.utils import fetch, filter_content from rsshub.utils import fetch, filter_content
from rsshub.utils import DEFAULT_HEADERS from rsshub.utils import DEFAULT_HEADERS
domain = 'https://www.businesswire.com' domain = 'businesswire.com'
def parse(post): def parse(post):
item = {} item = {}
item['title'] = post.css('span[itemprop=headline]::text').extract_first().strip() item['title'] = post.css('title::text').extract_first().strip()
item['description'] = item['title'] item['description'] = post.css('description::text').extract_first().strip(']]>')
item['link'] = f"{domain}{post.css('a.bwTitleLink::attr(href)').extract_first()}" item['link'] = post.css('guid::text').extract_first()
item['pubDate'] = post.css('time::text').extract_first().strip() item['pubDate'] = post.css('pubDate::text').extract_first()
return item return item
def ctx(category=''): def ctx(category=''):
tree = fetch(f"{domain}/portal/site/home/template.PAGE/news/", headers=DEFAULT_HEADERS) tree = fetch(f"https://feed.{domain}/rss/home/?rss=G1QFDERJXkJeGVtYWA==",
posts = tree.css('.bwNewsList li') headers=DEFAULT_HEADERS)
items = list(map(parse, posts)) posts = tree.css('item')
items = list(map(parse, posts))
items = filter_content(items) items = filter_content(items)
return { return {
'title': 'Earnings Date - Businesswire', 'title': 'Earnings Date - Businesswire',
'link': f'{domain}/portal/site/home/template.PAGE/news/', 'link': f'https://www.{domain}/portal/site/home/news/subject/?vnsId=31407',
'description': 'Earnings Date - Businesswire', 'description': 'Earnings Date - Businesswire',
'author': 'hillerliao', 'author': 'hillerliao',
'items': items 'items': items
} }