add headers to mp gh request

This commit is contained in:
hillerliao
2021-08-10 21:47:30 +08:00
parent 77f1412c0c
commit d9f4cfa44a

View File

@@ -1,4 +1,5 @@
from rsshub.utils import fetch
from rsshub.utils import DEFAULT_HEADERS
domain = 'https://weixin.sogou.com'
@@ -16,8 +17,8 @@ def parse(post):
def ctx(gh=''):
global url
url = f"{domain}/weixin?query={gh}"
tree = fetch(url)
url = f"{domain}/weixin?type=1&s_from=input&query={gh}&ie=utf8&_sug_=n&_sug_type_=&w=01019900&sut=1554&sst0=1628603087755&lkt=0%2C0%2C0"
tree = fetch(url=url, headers=DEFAULT_HEADERS)
global dd_num
dd_num = len( tree.css('dd') )
posts = [ tree.css('dd')[-1] ]