@cmd+आर.एफ.स.स.सी ८२२+nips-१३

This commit is contained in:
|| Prof. - Xadk3! 2023-05-04 05:54:48 +00:00
parent 0c708b3ccc
commit 585f6eb41b

View file

@ -3,8 +3,38 @@
import readline import readline
# import urllib.parse # import urllib.parse
from selenium import webdriver from selenium import webdriver
from sys import argv
tr_lang = 'ne';
class ArguMenToR:
def __init__(self, *args):
if 'help' in ' '.join(args[0]):
print(f'''
{argv[0]} [--lang=ne]
Choices:
Nepali: ne
Japanese: ja
Chinese: zh-(TW/CN)
English: en
Hindi: hi
''')
self.argv = list(args)[0]
self.param = 'lang'
self.parse()
def parse(self):
global tr_lang
spaced_args = ' '.join(self.argv[1:])
if spaced_args.startswith('-'):
if '=' in spaced_args:
tr_lang = spaced_args.split('=')[1]
else:
tr_lang = spaced_args
browser = webdriver.Firefox() browser = webdriver.Firefox()
ArguMenToR(argv)
_lang_conf = { _lang_conf = {
'nepali': 'ne', 'nepali': 'ne',
'english': 'en', 'english': 'en',
@ -18,8 +48,8 @@ _TRP_CONSTRUCT = "https://DOMAIN.translate.goog/PATH?_x_tr_sl=auto&_x_tr_tl=TRL"
# TODO: URL-parsing # TODO: URL-parsing
url = input("Enter URL you wish to translate: ") url = input("Enter URL you wish to translate: ")
_lang = _lang_conf['nepali'] # _lang = _lang_conf['nepali']
_TRP_CONSTRUCT = _TRP_CONSTRUCT.replace('TRL', _lang) _TRP_CONSTRUCT = _TRP_CONSTRUCT.replace('TRL', tr_lang)
remote_domain = url.split('://')[1].split('/')[0] remote_domain = url.split('://')[1].split('/')[0]
#print('-'.join(remote_domain.split('.')[1:])) #print('-'.join(remote_domain.split('.')[1:]))