zoukankan      html  css  js  c++  java
  • 一些翻译

    腾讯翻译

    分析:

    查看到translate_uuid1579275396885 可能为时间:
    测试:
    https://tool.lu/timestamp/

    搜索js:断点测试

    ##获取信息
    import requests
    import time
    
    headers = {
        'Origin': 'https://fanyi.qq.com',
        'Host': 'fanyi.qq.com',
        'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36'
    }
    
    t = time.time()
    x = int(round(t * 1000))
    
    data = {
        'source': 'auto',
        'target': 'zh',
        'sourceText': 'Some results are removed in response to a notice of local law requirement. For more information, please see here.',
        'qtv': 'eff218207daba212',
        'qtk': 'WP5YpSwXYvfQKyNQH355uBrYPXgPrMCzwcUUQrbMqiylk7mmk+XMdmUEndf2xcColq82CUzrKGZsI2kY3J5eRpStaupKGDfVJb9Vz3A2ug2geIyEuf2LFTsZVUWt1mI3aNbO3tJdocmPgTzbRRX6zA==',
        'sessionUuid': 'translate_uuid' + 'x'
    }
    
    # s = requests.Session()
    # ccc = s.get("https://fanyi.qq.com/", headers=headers)
    # response = s.post()
    response = requests.post("https://fanyi.qq.com/api/translate",headers=headers,data=data)
    
    print(response.status_code)
    print(response.content)
    
    
    ##返回
    200
    b'{"sessionUuid":"translate_uuidx","translate":{"errCode":0,"errMsg":"","sessionUuid":"translate_uuidx","source":"en","target":"zh","records":[{"sourceText":"Some results are removed in response to a notice of local law requirement.","targetText":"xe4xb8x80xe4xbax9bxe7xbbx93xe6x9ex9cxe8xa2xabxe7xa7xbbxe9x99xa4xefxbcx8cxe4xbbxa5xe5x93x8dxe5xbax94xe5xbdx93xe5x9cxb0xe6xb3x95xe5xbex8bxe8xa6x81xe6xb1x82xe7x9ax84xe9x80x9axe7x9fxa5xe3x80x82","traceId":"bd3f84e29dd84d089a35b91de346d3f3"},{"sourceText":"For more information, please see here.","targetText":"xe6x9cx89xe5x85xb3xe6x9bxb4xe5xa4x9axe4xbfxa1xe6x81xafxefxbcx8cxe8xafxb7xe6x9fxa5xe7x9cx8bxe6xadxa4xe5xa4x84xe3x80x82","traceId":"bd3f84e29dd84d089a35b91de346d3f3"}],"full":true,"options":{}},"dict":{"data":[{"en_hash":"00845fd66c8b33f8f7571d8e52236271","word":"Some"},{"word":"results"},{"en_hash":"b7a6462942a6c41e8971cbf4962b9d57","word":"are"},{"word":"removed"},{"en_hash":"f29a922120864c8888ea7f1ace1a03f7","word":"in"},{"en_hash":"617f40989d52d386182d303d887be8e9","word":"response"},{"en_hash":"182f6c32ee8c00150ec3c6f832920864","word":"to"},{"en_hash":"31bd09ffa5d86613973eef37797d0921","word":"a"},{"en_hash":"aa874850282c62558bc546bec20d1e34","word":"notice"},{"en_hash":"a206ed2f22c9043ec0d35457c3e07c68","word":"of"},{"en_hash":"c12d3f3effc81fadcf9c9cdf49aa502a","word":"local"},{"en_hash":"0c758b79e10c2a50919b62e31946ba0e","word":"law"},{"en_hash":"c4f7d64fcea0ea6bd5d3d773ad571ca7","word":"requirement"},{"en_hash":"0ede03943a8e89f8ead2063b2b35778b","word":"For"},{"en_hash":"661a278f375d348be2df89c619d8615c","word":"more"},{"en_hash":"adea0ec7e9783446cf1562f7ab0af4a7","word":"information"},{"en_hash":"9675c1af49f32c5fdeb7595514dc49f4","word":"please"},{"en_hash":"1e82c0b4b87990be486f8fafd35a836c","word":"see"},{"en_hash":"62b760a88e2810979e6f03195fbb91a7","word":"here"}],"errCode":0,"errMsg":"","type":"important words","map":{"Some":{"detailId":"00845fd66c8b33f8f7571d8e52236271"},"results":{},"are":{"detailId":"b7a6462942a6c41e8971cbf4962b9d57"},"removed":{},"in":{"detailId":"f29a922120864c8888ea7f1ace1a03f7"},"response":{"detailId":"617f40989d52d386182d303d887be8e9"},"to":{"detailId":"182f6c32ee8c00150ec3c6f832920864"},"a":{"detailId":"31bd09ffa5d86613973eef37797d0921"},"notice":{"detailId":"aa874850282c62558bc546bec20d1e34"},"of":{"detailId":"a206ed2f22c9043ec0d35457c3e07c68"},"local":{"detailId":"c12d3f3effc81fadcf9c9cdf49aa502a"},"law":{"detailId":"0c758b79e10c2a50919b62e31946ba0e"},"requirement":{"detailId":"c4f7d64fcea0ea6bd5d3d773ad571ca7"},"For":{"detailId":"0ede03943a8e89f8ead2063b2b35778b"},"more":{"detailId":"661a278f375d348be2df89c619d8615c"},"information":{"detailId":"adea0ec7e9783446cf1562f7ab0af4a7"},"please":{"detailId":"9675c1af49f32c5fdeb7595514dc49f4"},"see":{"detailId":"1e82c0b4b87990be486f8fafd35a836c"},"here":{"detailId":"62b760a88e2810979e6f03195fbb91a7"}}},"suggest":null,"errCode":0,"errMsg":"ok"}'
    
    
    
    
    
    
    
    
    
    ##json格式化
    
    {
        "sessionUuid": "translate_uuidx", 
        "translate": {
            "errCode": 0, 
            "errMsg": "", 
            "sessionUuid": "translate_uuidx", 
            "source": "en", 
            "target": "zh", 
            "records": [
                {
                    "sourceText": "Some results are removed in response to a notice of local law requirement.", 
                    "targetText": "一些结果被移除,以响应当地法律要求的通知。", 
                    "traceId": "bd3f84e29dd84d089a35b91de346d3f3"
                }, 
                {
                    "sourceText": "For more information, please see here.", 
                    "targetText": "有关更多信息,请查看此处。", 
                    "traceId": "bd3f84e29dd84d089a35b91de346d3f3"
                }
            ], 
            "full": true, 
            "options": { }
        }, 
        "dict": {
            "data": [
                {
                    "en_hash": "00845fd66c8b33f8f7571d8e52236271", 
                    "word": "Some"
                }, 
                {
                    "word": "results"
                }, 
                {
                    "en_hash": "b7a6462942a6c41e8971cbf4962b9d57", 
                    "word": "are"
                }, 
                {
                    "word": "removed"
                }, 
                {
                    "en_hash": "f29a922120864c8888ea7f1ace1a03f7", 
                    "word": "in"
                }, 
                {
                    "en_hash": "617f40989d52d386182d303d887be8e9", 
                    "word": "response"
                }, 
                {
                    "en_hash": "182f6c32ee8c00150ec3c6f832920864", 
                    "word": "to"
                }, 
                {
                    "en_hash": "31bd09ffa5d86613973eef37797d0921", 
                    "word": "a"
                }, 
                {
                    "en_hash": "aa874850282c62558bc546bec20d1e34", 
                    "word": "notice"
                }, 
                {
                    "en_hash": "a206ed2f22c9043ec0d35457c3e07c68", 
                    "word": "of"
                }, 
                {
                    "en_hash": "c12d3f3effc81fadcf9c9cdf49aa502a", 
                    "word": "local"
                }, 
                {
                    "en_hash": "0c758b79e10c2a50919b62e31946ba0e", 
                    "word": "law"
                }, 
                {
                    "en_hash": "c4f7d64fcea0ea6bd5d3d773ad571ca7", 
                    "word": "requirement"
                }, 
                {
                    "en_hash": "0ede03943a8e89f8ead2063b2b35778b", 
                    "word": "For"
                }, 
                {
                    "en_hash": "661a278f375d348be2df89c619d8615c", 
                    "word": "more"
                }, 
                {
                    "en_hash": "adea0ec7e9783446cf1562f7ab0af4a7", 
                    "word": "information"
                }, 
                {
                    "en_hash": "9675c1af49f32c5fdeb7595514dc49f4", 
                    "word": "please"
                }, 
                {
                    "en_hash": "1e82c0b4b87990be486f8fafd35a836c", 
                    "word": "see"
                }, 
                {
                    "en_hash": "62b760a88e2810979e6f03195fbb91a7", 
                    "word": "here"
                }
            ], 
            "errCode": 0, 
            "errMsg": "", 
            "type": "important words", 
            "map": {
                "Some": {
                    "detailId": "00845fd66c8b33f8f7571d8e52236271"
                }, 
                "results": { }, 
                "are": {
                    "detailId": "b7a6462942a6c41e8971cbf4962b9d57"
                }, 
                "removed": { }, 
                "in": {
                    "detailId": "f29a922120864c8888ea7f1ace1a03f7"
                }, 
                "response": {
                    "detailId": "617f40989d52d386182d303d887be8e9"
                }, 
                "to": {
                    "detailId": "182f6c32ee8c00150ec3c6f832920864"
                }, 
                "a": {
                    "detailId": "31bd09ffa5d86613973eef37797d0921"
                }, 
                "notice": {
                    "detailId": "aa874850282c62558bc546bec20d1e34"
                }, 
                "of": {
                    "detailId": "a206ed2f22c9043ec0d35457c3e07c68"
                }, 
                "local": {
                    "detailId": "c12d3f3effc81fadcf9c9cdf49aa502a"
                }, 
                "law": {
                    "detailId": "0c758b79e10c2a50919b62e31946ba0e"
                }, 
                "requirement": {
                    "detailId": "c4f7d64fcea0ea6bd5d3d773ad571ca7"
                }, 
                "For": {
                    "detailId": "0ede03943a8e89f8ead2063b2b35778b"
                }, 
                "more": {
                    "detailId": "661a278f375d348be2df89c619d8615c"
                }, 
                "information": {
                    "detailId": "adea0ec7e9783446cf1562f7ab0af4a7"
                }, 
                "please": {
                    "detailId": "9675c1af49f32c5fdeb7595514dc49f4"
                }, 
                "see": {
                    "detailId": "1e82c0b4b87990be486f8fafd35a836c"
                }, 
                "here": {
                    "detailId": "62b760a88e2810979e6f03195fbb91a7"
                }
            }
        }, 
        "suggest": null, 
        "errCode": 0, 
        "errMsg": "ok"
    }
    
    
    
    ##目标文字转码
    res=b'xe4xb8x80xe4xbax9bxe7xbbx93xe6x9ex9cxe8xa2xabxe7xa7xbbxe9x99xa4xefxbcx8cxe4xbbxa5xe5x93x8dxe5xbax94xe5xbdx93xe5x9cxb0xe6xb3x95xe5xbex8bxe8xa6x81xe6xb1x82xe7x9ax84xe9x80x9axe7x9fxa5xe3x80x82'
    print(res.decode('utf-8'))
    一些结果被移除,以响应当地法律要求的通知。
    
    
    res = b'xe6x9cx89xe5x85xb3xe6x9bxb4xe5xa4x9axe4xbfxa1xe6x81xafxefxbcx8cxe8xafxb7xe6x9fxa5xe7x9cx8bxe6xadxa4xe5xa4x84xe3x80x82'
    print(res.decode('utf-8'))
    有关更多信息,请查看此处。
    

    另外qtv qtk 会变

    第一次请求https://fanyi.qq.com/ 会回去两个变量的值,在源码中搜索即可获取。

    在后续请求中会作为data post 到服务器

    
    source: auto
    target: zh
    sourceText: hello 
    qtv: c6d9e381c255da5d
    qtk: ea6X0/gZjfFIcbkotJ+d642Gcs6V5Y1C1acTz6p0XG8RJTCaPHaTZNCOnBtmrqBx8OP/NB8cP2GvY3uf6R9k32gU0UoaahKo+LehIBBpSGoeze1dqB4ozEeBkrUIXqATOuewWrmnxSjuelqkCilBQw==
    sessionUuid: translate_uuid1579276266519
    
    
  • 相关阅读:
    Redis 简介
    图片懒加载、selenium和PhantomJS
    Python网络爬虫之三种数据解析方式
    Scrapy框架之CrawlSpider
    Scrapy 框架
    python 网络爬虫概念与HTTP(s)协议
    Mysql概念及基本操作
    Python re 模块
    线程与进程应用场景
    全局解释器锁 GIL
  • 原文地址:https://www.cnblogs.com/g2thend/p/12207940.html
Copyright © 2011-2022 走看看