Some translation

Tencent translation

analysis:

View may be time to translate_uuid1579275396885:
Test:
https://tool.lu/timestamp/

Search js: Breakpoints

##获取信息
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":"\xe4\xb8\x80\xe4\xba\x9b\xe7\xbb\x93\xe6\x9e\x9c\xe8\xa2\xab\xe7\xa7\xbb\xe9\x99\xa4\xef\xbc\x8c\xe4\xbb\xa5\xe5\x93\x8d\xe5\xba\x94\xe5\xbd\x93\xe5\x9c\xb0\xe6\xb3\x95\xe5\xbe\x8b\xe8\xa6\x81\xe6\xb1\x82\xe7\x9a\x84\xe9\x80\x9a\xe7\x9f\xa5\xe3\x80\x82","traceId":"bd3f84e29dd84d089a35b91de346d3f3"},{"sourceText":"For more information, please see here.","targetText":"\xe6\x9c\x89\xe5\x85\xb3\xe6\x9b\xb4\xe5\xa4\x9a\xe4\xbf\xa1\xe6\x81\xaf\xef\xbc\x8c\xe8\xaf\xb7\xe6\x9f\xa5\xe7\x9c\x8b\xe6\xad\xa4\xe5\xa4\x84\xe3\x80\x82","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'\xe4\xb8\x80\xe4\xba\x9b\xe7\xbb\x93\xe6\x9e\x9c\xe8\xa2\xab\xe7\xa7\xbb\xe9\x99\xa4\xef\xbc\x8c\xe4\xbb\xa5\xe5\x93\x8d\xe5\xba\x94\xe5\xbd\x93\xe5\x9c\xb0\xe6\xb3\x95\xe5\xbe\x8b\xe8\xa6\x81\xe6\xb1\x82\xe7\x9a\x84\xe9\x80\x9a\xe7\x9f\xa5\xe3\x80\x82'
print(res.decode('utf-8'))
一些结果被移除,以响应当地法律要求的通知。


res = b'\xe6\x9c\x89\xe5\x85\xb3\xe6\x9b\xb4\xe5\xa4\x9a\xe4\xbf\xa1\xe6\x81\xaf\xef\xbc\x8c\xe8\xaf\xb7\xe6\x9f\xa5\xe7\x9c\x8b\xe6\xad\xa4\xe5\xa4\x84\xe3\x80\x82'
print(res.decode('utf-8'))
有关更多信息,请查看此处。

In addition qtv qtk become

The first request will go back https://fanyi.qq.com/ two variables, search the source code can be acquired.

In subsequent requests to the server will be used as data post


source: auto
target: zh
sourceText: hello 
qtv: c6d9e381c255da5d
qtk: ea6X0/gZjfFIcbkotJ+d642Gcs6V5Y1C1acTz6p0XG8RJTCaPHaTZNCOnBtmrqBx8OP/NB8cP2GvY3uf6R9k32gU0UoaahKo+LehIBBpSGoeze1dqB4ozEeBkrUIXqATOuewWrmnxSjuelqkCilBQw==
sessionUuid: translate_uuid1579276266519

Guess you like

Origin www.cnblogs.com/g2thend/p/12207940.html