您好,登錄后才能下訂單哦!
本篇內容主要講解“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。