zoukankan      html  css  js  c++  java
  • 通过修改User-Agent值达到浏览器伪装

    # 浏览器伪装
    
    import urllib.request
    
    url = "https://blog.csdn.net/weixin_42760923"
    res = urllib.request.urlopen(url).read().decode("utf-8")
    # 头文件格式header=("User-Agent","具体用户代理值")
    headers = ("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")
    opener = urllib.request.build_opener()
    data = opener.open(url).read()
    with open("../伪装浏览器.html", "wb") as f:
        f.write(data)
  • 相关阅读:
    LabVIEW入门第三天(软件及驱动包下载)
    poj1732
    poj1722
    poj1821
    poj1770
    poj1949
    poj1726
    poj1699
    poj1682
    poj1853
  • 原文地址:https://www.cnblogs.com/CesareZhang/p/12449408.html
Copyright © 2011-2022 走看看