Initial commit: 百家号文章采集系统

This commit is contained in:
sjk
2025-12-19 22:48:58 +08:00
commit 0d5bbb1864
37 changed files with 11774 additions and 0 deletions

43
demo_python.py Normal file
View File

@@ -0,0 +1,43 @@
import requests
import time
if __name__ == '__main__':
# 客户ip提取链接,每次提取1个提取链接可以换成自己购买的
url = 'http://api.tianqiip.com/getip?secret=lu29e593&num=1&type=txt&port=1&mr=1&sign=4b81a62eaed89ba802a8f34053e2c964'
# 访问的目标地址
targeturl = 'https://mbd.baidu.com/webpage?tab=main&num=10&uk=ntHidnLhrlfclJar2z8wBg&source=pc&type=newhome&action=dynamic&format=jsonp&otherext=h5_20251126173230&Tenger-Mhor=3659421940&callback=__jsonp01765201579331'
response = requests.get(url)
content =response.content.decode("utf-8").strip()
print('提取IP' + content)
nowtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
print('提取IP时间' + nowtime)
sj = content.strip().split(":", 1)
sj1 = sj[0]
print("IP", sj1)
sj2 = sj[1]
print("端口:", sj2)
try:
#proxyMeta = "http://nfd0p2:bHQAp5iW@%(host)s:%(port)s" % { # 账密验证,需要购买的代理套餐开通才可使用账密验证,此种情况无需加白名单
proxyMeta = f"http://{sj1}:{sj2}"
print("代理1", proxyMeta)
proxysdata = {
'http': proxyMeta,
'https': proxyMeta
}
print("代理2", proxysdata)
headers = {
"user-agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.'
}
start = int(round(time.time() * 1000))
resp = requests.get(targeturl, proxies=proxysdata, headers=headers, timeout=20)
costTime = int(round(time.time() * 1000)) - start
print("耗时:" + str(costTime) + "ms")
print("返回:",resp.text)
s = requests.session()
s.keep_alive = False
except Exception as e:
print("异常:",e)