本篇内容主要讲解“Python怎么破解有道JS加密”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Python怎么破解有道JS加密”吧!
开发环境:
解释器: Python 3.6.5 | Anaconda, Inc.
编辑器: pycharm 社区版
部分代码
import random import timeimport requestsfrom hashlib import md5# 输入想要访问的网址post_url = 'http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule' appVersion = "5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36" # 请求头参数headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9", "Cache-Control": "no-cache", "Connection": "keep-alive", "Content-Length": "281", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Cookie": "OUTFOX_SEARCH_USER_ID=728181645@10.169.0.82; OUTFOX_SEARCH_USER_ID_NCOO=1392777521.250264; JSESSIONID=aaaapitSB3EHV64Y44Spx; ___rl__test__cookies=1597407303179", "Host": "fanyi.youdao.com", "Origin": "http://fanyi.youdao.com", "Pragma": "no-cache", "Referer": "http://fanyi.youdao.com/", "User-Agent": appVersion, "X-Requested-With": "XMLHttpRequest", if __name__ == '__main__': # while True: # word = input('请输入你想要的翻译的内容:') with open('文章内容.txt', mode='r', encoding='utf-8') as f: text = f.read() results = fanyi(text) r_s = results['translateResult'][0] with open('双语.txt', mode='w', encoding='utf-8') as f: for r in r_s: f.write(r['src']) f.write('\n') f.write(r['tgt']) f.write('\n') f.write('\n') print(r['src']) print(r['tgt']) # 制作成双语的文章 # 想要完整源码的同学可以关注我的公众号:松鼠爱吃饼干 # 回复“有道翻译”即可免费获取
效果如下
到此,相信大家对“Python怎么破解有道JS加密”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。