• <爬虫>必应翻译爬虫


    1.基本信息

    目标网站:必应翻译

    网址:https://cn.bing.com/translator/

    2.网址分析

    • 输入单词实时在下方生成翻译(局部AJAX)

    3.抓包分析

      

    想知道结果

     

    得到的具体参数

     

     

    请求网址:https://cn.bing.com/tlookupv3?isVertical=1&&IG=D1D6D2C1740B4F9E8F51A06BEC3B4FBF&IID=translator.5025.2

    请求方式:POST

    携带参数:

        'from':'en',
        'to': 'zh-Hans',
        'text': 'China',
    

      

    4.具体的结果

    import requests
    
    url = 'https://cn.bing.com/tlookupv3?isVertical=1&&IG=D1D6D2C1740B4F9E8F51A06BEC3B4FBF&IID=translator.5025.2'
    
    headers = {
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
    }
    
    data = {
        'from':'en',
        'to': 'zh-Hans',
        'text': 'China',
    }
    
    response = requests.post(url, headers=headers, data=data)
    
    if response.status_code == 200:
        print(response.content.decode('utf-8'))

    运行结果

  • 相关阅读:
    从服务器角度分析RPG游戏——NPC的AI
    羽翼特效设计
    坐骑特效设计(二)
    坐骑特效设计
    Unity AssetBundle打包资源工具
    有趣的进度条
    原生与组件
    bower
    yeoman
    grunt+bower+yo
  • 原文地址:https://www.cnblogs.com/shuimohei/p/14086271.html
Copyright © 2020-2023  润新知