mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 15:09:23 +00:00
Merge branch 'master' of github.com:hillerliao/RSSHub-python
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import urllib.parse
|
||||
from urllib.parse import quote, unquote
|
||||
from rsshub.utils import fetch, DEFAULT_HEADERS
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@ def parse(post):
|
||||
|
||||
|
||||
def ctx(category='', keywords=''):
|
||||
keywords_encode = urllib.parse.quote(keywords, encoding='gbk')
|
||||
url = f"{domain}/data/search.php?keyWords={keywords_encode}&searchfield={category}"
|
||||
keywords = unquote(keywords,encoding='utf-8')
|
||||
keywords_gbk = quote(keywords, encoding='gbk')
|
||||
url = f"{domain}/data/search.php?keyWords={keywords_gbk}&searchfield={category}"
|
||||
tree = fetch(url, headers=DEFAULT_HEADERS)
|
||||
posts = tree.css('.search_list').css('li')
|
||||
return {
|
||||
|
||||
@@ -6,9 +6,9 @@ domain = 'https://www.economist.com'
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('div.e18qdnq10').get()
|
||||
item['title'] = re.sub(r'<[^>]*>', '', item['title']).strip()
|
||||
item['title'] = post.css('div').css('p').get()
|
||||
item['description'] = item['title']
|
||||
item['title'] = re.sub(r'<[^>]*>', '', item['title']).strip()
|
||||
item['link'] = f"{domain}/the-world-in-brief" + '?from=' + item['title'][:30]
|
||||
return item
|
||||
|
||||
|
||||
Reference in New Issue
Block a user