wangkun 2 年 前
コミット
432abc9f59
2 ファイル変更11 行追加2 行削除
  1. 9 1
      main/demo.py
  2. 2 1
      main/haokan_follow.py

+ 9 - 1
main/demo.py

@@ -211,9 +211,17 @@ class Demo:
             print(f'video_url:{video_url}')
             print('\n')
 
+    @classmethod
+    def test_str(cls):
+        s1 = '\u7f51\u7edc\u9519\u8bef\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\uff01'
+        s2 = s1.encode('gb2312')
+        print(s1)
+        print(s2)
+
 
 if __name__ == '__main__':
-    Demo.get_sheet('demo', 'haokan', 'kVaSjf')
+    Demo.test_str()
+    # Demo.get_sheet('demo', 'haokan', 'kVaSjf')
     # Demo.publish_time()
     # Demo.get_video_url('demo', '10377041690614321392')
     # Demo.get_follow_users('demo')

+ 2 - 1
main/haokan_follow.py

@@ -65,7 +65,7 @@ class Follow:
                 url = 'https://haokan.baidu.com/web/author/listall?'
                 headers = {
                     'Accept': '*/*',
-                    'Accept-Encoding': 'gzip, deflate',
+                    'Accept-Encoding': 'gzip, deflate, br',
                     'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
                     'Cache-Control': 'no-cache',
                     'Connection': 'keep-alive',
@@ -73,6 +73,7 @@ class Follow:
                     'Cookie': Feishu.get_values_batch(log_type, 'haokan', '5LksMx')[0][0],
                     'Referer': 'https://haokan.baidu.com/author/'+str(out_id),
                     'Pragma': 'no-cache',
+                    'Host': 'haokan.baidu.com',
                     'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Microsoft Edge";v="108"',
                     'sec-ch-ua-mobile': '?0',
                     'sec-ch-ua-platform': '"macOS"',