diff options
| -rw-r--r-- | tuisong_ym_ip/selenium_status.py | 2 | ||||
| -rw-r--r-- | tuisong_ym_ip/tiaoxuan_web_zy.py | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/tuisong_ym_ip/selenium_status.py b/tuisong_ym_ip/selenium_status.py index 078f5da..70540a5 100644 --- a/tuisong_ym_ip/selenium_status.py +++ b/tuisong_ym_ip/selenium_status.py @@ -86,7 +86,7 @@ def web_status_jieguo(domain): if __name__ == '__main__': - result = web_status_jieguo('https://baidu.com') + result = web_status_jieguo('https://www.jd.com') print(result) # todo 1 # with open('result/meiyou_pipeidao1.txt',encoding='utf8') as f1: diff --git a/tuisong_ym_ip/tiaoxuan_web_zy.py b/tuisong_ym_ip/tiaoxuan_web_zy.py new file mode 100644 index 0000000..d1d62a8 --- /dev/null +++ b/tuisong_ym_ip/tiaoxuan_web_zy.py @@ -0,0 +1,29 @@ +# 从日志中挑出指定网站的资源 + +# # todo 1 +# with open('tuisong_log/2024-10-07.log',encoding='utf8') as f: +# for line in f: +# ll = line.strip().split('\t') +# ym,ip,zhuym = ll[0],ll[1],ll[3] +# ym_list = ['api.x.com','abs.twimg.com','x.com','abs-0.twimg.com','twitter.com'] +# if 'twitter' in zhuym and ym in ym_list: +# # if 'twitter' in zhuym: +# with open('tiaoxuan_web_ziyuan/x_1009.txt','a',encoding='utf8') as f1: +# f1.write(ym+'\t'+ip+'\n') + + +# todo 2 +from write_mysql import MySQL +lianjie = MySQL('wh_www_twitter_com_resources') +with open('tiaoxuan_web_ziyuan/x_1009.txt',encoding='utf8') as f: + for line in f: + ym,ip = line.strip().split('\t') + sql1 = f"SELECT network_url FROM `functions` where domain='{ym}' ORDER BY datetime DESC limit 1" + shuju = lianjie.ExecQuery(sql1) + print(shuju) + if len(shuju)>0: + url = shuju[0][0] + else: + url = f'https://{ym}' + with open('tiaoxuan_web_ziyuan/x1009_url.txt', 'a', encoding='utf8') as f1: + f1.write(ym+'\t'+ip+'\t'+url+'\n')
\ No newline at end of file |
