@cmt++RFC८२२+nips-१३++
This commit is contained in:
parent
61f03e787a
commit
49106b601a
1 changed files with 13 additions and 4 deletions
17
translate.py
17
translate.py
|
@ -4,7 +4,16 @@ import readline
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
|
||||||
browser = webdriver.Firefox()
|
browser = webdriver.Firefox()
|
||||||
TRP_CONSTRUCT = "https://DOMAIN.translate.goog/PATH/?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp"
|
_lang_conf = {
|
||||||
|
'nepali': 'ne',
|
||||||
|
'english': 'en',
|
||||||
|
'japanese': 'ja',
|
||||||
|
'chinese-tradional': 'zh-TW',
|
||||||
|
'chinese-simplified': 'zh-CN',
|
||||||
|
'hindi': 'hi'
|
||||||
|
}; TRP_CONSTRUCT = "https://DOMAIN.translate.goog/PATH/?_x_tr_sl=auto&_x_tr_tl=[TRL]&_x_tr_hl=en-US&_x_tr_pto=wapp"
|
||||||
|
neTRP_CONSTRUCT = TRP_CONSTRUCT.replace('[TRL]', 'ne')
|
||||||
|
enTRP_CONSTRUCT = TRP_CONSTRUCT.replace('[TRL]', 'en') # yet another globals object !
|
||||||
|
|
||||||
url = input("Enter URL you wish to translate: ")
|
url = input("Enter URL you wish to translate: ")
|
||||||
remote_domain = url.split('://')[1].split('/')[0]
|
remote_domain = url.split('://')[1].split('/')[0]
|
||||||
|
@ -13,10 +22,10 @@ rDUri = remote_domain.replace('.', '-')
|
||||||
if '?' in remote_path:
|
if '?' in remote_path:
|
||||||
remote_path = remote_path.split('?')[0]
|
remote_path = remote_path.split('?')[0]
|
||||||
remote_URL_query = ''.join(url.split('?')[1:])
|
remote_URL_query = ''.join(url.split('?')[1:])
|
||||||
rUrl = TRP_CONSTRUCT.replace('DOMAIN', rDUri).replace('PATH', remote_path) + '&' + remote_URL_query
|
rUrl = neTRP_CONSTRUCT.replace('DOMAIN', rDUri).replace('PATH', remote_path) + '&' + remote_URL_query
|
||||||
else:
|
else:
|
||||||
rUrl = TRP_CONSTRUCT.replace('DOMAIN', rDUri).replace('PATH', remote_path)
|
rUrl = neTRP_CONSTRUCT.replace('DOMAIN', rDUri).replace('PATH', remote_path)
|
||||||
|
|
||||||
print("Executing :" + rUrl + " \nwithin DOM.")
|
print("Executing: " + rUrl + " \n\twithin #DOM .")
|
||||||
browser.get(rUrl)
|
browser.get(rUrl)
|
||||||
browser.execute_script('''document.querySelector('iframe').style.display = "none";document.querySelector('iframe').remove()''')
|
browser.execute_script('''document.querySelector('iframe').style.display = "none";document.querySelector('iframe').remove()''')
|
||||||
|
|
Loading…
Reference in a new issue