|
@@ -1,28 +1,27 @@
|
|
|
-logs = {'level': 'INFO',
|
|
|
- 'message': '{"message":{'
|
|
|
- '"method":"Network.requestWillBeSent",'
|
|
|
- '"params":{'
|
|
|
- '"documentURL":"https://www.ixigua.com/?wid_try=1",'
|
|
|
- '"frameId":"698D690DBD747CCE87288D66C4A8A45C",'
|
|
|
- '"hasUserGesture":false,'
|
|
|
- '"initiator":{"stack":{"callFrames":[{"columnNumber":48473,"functionName":"",'
|
|
|
- '"lineNumber":4,'
|
|
|
- '"scriptId":"21",'
|
|
|
- '"url":"https://lf-cdn-tos.bytescm.com/obj/static/secsdk/secsdk-lastest.umd.js"}]},'
|
|
|
- '"type":"script"},'
|
|
|
- '"loaderId":"51BC9A78F355D630AB0CFCAEC204D50A",'
|
|
|
- '"redirectHasExtraInfo":false,'
|
|
|
- '"request":{'
|
|
|
- '"hasPostData":true,'
|
|
|
- '"headers":{'
|
|
|
- '"Accept":"application/json,'
|
|
|
- ' text/plain, */*",'
|
|
|
- '"Content-Type":"application/json","Referer":"https://www.ixigua.com/?wid_try=1",'
|
|
|
- '"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36",'
|
|
|
- '"sec-ch-ua":"\\"Chromium\\";v=\\"112\\",'
|
|
|
- ' \\"Google Chrome\\";v=\\"112\\",'
|
|
|
- ' \\"Not:A-Brand\\";v=\\"99\\"",'
|
|
|
- '"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\\"macOS\\"","x-secsdk-csrf-token":"00010000000129b3d18037305ef04702bb32df2f7f97e19d50b9c5129deb08d9bee0fd9dc68c1754743c2ea56cf0"},"initialPriority":"High","isSameSite":true,"method":"POST","mixedContentType":"none","postData":"{\\"r\\":true,\\"d\\":[{\\"k\\":\\"page_sub_channel\\",\\"v\\":\\"{\\\\\\"datetime\\\\\\":1681096362436,\\\\\\"channel_name\\\\\\":\\\\\\"home\\\\\\"}\\"}]}","postDataEntries":[{"bytes":"eyJyIjp0cnVlLCJkIjpbeyJrIjoicGFnZV9zdWJfY2hhbm5lbCIsInYiOiJ7XCJkYXRldGltZVwiOjE2ODEwOTYzNjI0MzYsXCJjaGFubmVsX25hbWVcIjpcImhvbWVcIn0ifV19"}],"referrerPolicy":"strict-origin-when-cross-origin",'
|
|
|
- '"url":"https://www.ixigua.com/at/log/c?aid=1768&msToken=&X-Bogus=DFSzswSOGSy6Sh-htVAcJR/F6q98&_signature=_02B4Z6wo00001O38UmAAAIDBlTK5ZUm9hMDt7HbAAF9Se5"},"requestId":"1969.180",'
|
|
|
- '"timestamp":3139.795561,"type":"XHR","wallTime":1681096362.632288}},"webview":"698D690DBD747CCE87288D66C4A8A45C"}',
|
|
|
- 'timestamp': 1681096362632}
|
|
|
+import os
|
|
|
+import sys
|
|
|
+
|
|
|
+sys.path.append(os.getcwd())
|
|
|
+from common.scheduling_db import MysqlHelper
|
|
|
+
|
|
|
+
|
|
|
+class Demo:
|
|
|
+ @classmethod
|
|
|
+ def get_config(cls, log_type, crawler, env):
|
|
|
+ select_sql = f"""select * from crawler_config where source="xigua" """
|
|
|
+ contents = MysqlHelper.get_values(log_type, crawler, select_sql, env, action='')
|
|
|
+ for content in contents:
|
|
|
+ config = content['config']
|
|
|
+ print(type(config))
|
|
|
+ print(config)
|
|
|
+ print(type(eval(config)))
|
|
|
+ token = eval(config['token'])
|
|
|
+ # emoji = config['emoji']
|
|
|
+ # filter = config['filter']
|
|
|
+ print(f"token:{token}")
|
|
|
+ # print(f"emoji:{emoji}")
|
|
|
+ # print(f"filter:{filter}")
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == "__main__":
|
|
|
+ Demo.get_config("demo", "xiaoniangao", "dev")
|