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 DEFAULT_HEADERS
domain = 'https://www.businesswire.com'
domain = 'businesswire.com'
def parse(post):
item = {}
item['title'] = post.css('span[itemprop=headline]::text').extract_first().strip()
item['description'] = item['title']
item['link'] = f"{domain}{post.css('a.bwTitleLink::attr(href)').extract_first()}"
item['pubDate'] = post.css('time::text').extract_first().strip()
item['title'] = post.css('title::text').extract_first().strip()
item['description'] = post.css('description::text').extract_first().strip(']]>')
item['link'] = post.css('guid::text').extract_first()
item['pubDate'] = post.css('pubDate::text').extract_first()
return item
def ctx(category=''):
tree = fetch(f"{domain}/portal/site/home/template.PAGE/news/", headers=DEFAULT_HEADERS)
posts = tree.css('.bwNewsList li')
items = list(map(parse, posts))
tree = fetch(f"https://feed.{domain}/rss/home/?rss=G1QFDERJXkJeGVtYWA==",
headers=DEFAULT_HEADERS)
posts = tree.css('item')
items = list(map(parse, posts))
items = filter_content(items)
return {
'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',
'author': 'hillerliao',
'items': items
}
}