去评论
dz插件网

智能提取文章正文接口,自己接GPT API伪原创吧

逝水年华
2024/02/23 16:12:33
import requests
import urllib.parse

# 待编码的URL
original_url = "https://baijiahao.baidu.com/s?id=1791630747361105381"

# 对URL进行编码
encoded_url = urllib.parse.quote(original_url)

# 构建请求的目标URL
target_url = f"https://dome.imjett.pp.ua/get_article_content/link?url={encoded_url}"

# 发起请求
response = requests.get(target_url)

# 检查请求是否成功
if response.status_code == 200:
    print("请求成功,返回的内容如下:")
    # 打印返回的内容
    print(response.text)
else:
    print("请求失败,状态码:", response.status_code)

请求示例:https://dome.imjett.pp.ua/get_article_content/link?url=https://www.zhihu.com/question/340253665/answer/3148237594

在线运行代码:https://www.w3cschool.cn/tryrun/runcode?lang=python3