Wsmachilus 2021-10-31 03:50 采纳率: 0%
浏览 29

python爬取某网页代码时无法显示真实代码


import requests

url = "https://www.zhipin.com/c101010100-p100109/?query=python" #请求地址
headers = {"User-Agent": "Mozilla/5.0"} #请求头
response =  requests.get(url,headers=headers)
html = response.text
print(html)

如上为python代码
得到的代码

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
        <title>请稍后</title>
        <style>
            html,
            body {
                margin: 0;
                width: 100%;
                height: 100%;
            }
            @keyframes bossLoading {
                0% {
                    transform: translate3d(0, 0, 0);
                }
                50% {
                    transform: translate3d(0, -10px, 0);
                }
            }
            .data-tips {
                text-align: center;
                height: 100%;
                position: relative;
                background: #fff;
                top: 50%;
                margin-top: -37px;
            }
            .data-tips .boss-loading {
                width: 100%;
            }
            .data-tips .boss-loading p {
                margin-top: 10px;
                color: #9fa3b0;
            }
            .boss-loading .component-b,
            .boss-loading .component-s1,
            .boss-loading .component-o,
            .boss-loading .component-s2 {
                display: inline-block;
                width: 40px;
                height: 42px;
                line-height: 42px;
                font-family: Helvetica Neue,Helvetica,Arial,Hiragino Sans GB,Hiragino Sans GB W3,Microsoft YaHei UI,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif;
                font-weight: bolder;
                font-size: 40px;
                color: #eceef2;
                vertical-align: top;
                -webkit-animation-fill-mode: both;
                -webkit-animation: bossLoading 0.6s infinite linear alternate;
                -moz-animation: bossLoading 0.6s infinite linear alternate;
                animation: bossLoading 0.6s infinite linear alternate;
            }
            .boss-loading .component-o {
                -webkit-animation-delay: 0.1s;
                -moz-animation-delay: 0.1s;
                animation-delay: 0.1s;
            }
            .boss-loading .component-s1 {
                -webkit-animation-delay: 0.2s;
                -moz-animation-delay: 0.2s;
                animation-delay: 0.2s;
            }
            .boss-loading .component-s2 {
                -webkit-animation-delay: 0.3s;
                -moz-animation-delay: 0.3s;
                animation-delay: 0.3s;
            }
        </style>
    </head>
    <body>
        <div class="data-tips">
            <div class="tip-inner">
                <div class="boss-loading">
                    <span class="component-b">B</span><span class="component-o">O</span><span class="component-s1">S</span><span class="component-s2">S</span>
                    <p class="gray">正在加载中...</p>
                </div>
            </div>
        </div>
        <script>
           这里省略
        </script>
    </body>
</html>

  • 写回答

2条回答 默认 最新

  • pxl752556462 2021-10-31 11:21
    关注

    请求头内未设置cookie。

    评论

报告相同问题?

问题事件

  • 创建了问题 10月31日

悬赏问题

  • ¥30 基于信创PC发布的QT应用如何跨用户启动后输入中文
  • ¥20 非root手机,如何精准控制手机流量消耗的大小,如20M
  • ¥15 远程安装一下vasp
  • ¥15 自己做的代码上传图片时,报错
  • ¥15 Lingo线性规划模型怎么搭建
  • ¥15 关于#python#的问题,请各位专家解答!区间型正向化
  • ¥15 unity从3D升级到urp管线,打包ab包后,材质全部变紫色
  • ¥50 comsol温度场仿真无法模拟微米级激光光斑
  • ¥15 上传图片时提交的存储类型
  • ¥15 VB.NET如何绘制倾斜的椭圆