import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
					_lowerCAmelCase       =		"%20".join(argv[1:]) if len(argv) > 1 else quote(str(input("Search: ")))

					print("Googling.....")

					_lowerCAmelCase       =		f'https://www.google.com/search?q={query}&num=100'

					_lowerCAmelCase       =		requests.get(
					    url,
					    headers={"User-Agent": str(UserAgent().random)},
					)

					try:
										_lowerCAmelCase       =		(
										    BeautifulSoup(res.text, "html.parser")
										    .find("div", attrs={"class": "yuRUbf"})
										    .find("a")
										    .get("href")
										)

					except AttributeError:
										_lowerCAmelCase       =		parse_qs(
										    BeautifulSoup(res.text, "html.parser")
										    .find("div", attrs={"class": "kCrYT"})
										    .find("a")
										    .get("href")
										)["url"][0]

					webbrowser.open(link)





'''simple docstring'''





import string

def 			a_	(				_lowerCAmelCase			) -> str:
  __lowerCamelCase			:			Union[str, Any]       			=					''
  for i in sequence:
    __lowerCamelCase			:			Tuple       			=					ord(_lowerCAmelCase			)
    if 65 <= extract <= 90:
      output += chr(155 - extract			)
    elif 97 <= extract <= 122:
      output += chr(219 - extract			)
    else:
      output += i
  return output

def 			a_	(				_lowerCAmelCase			) -> str:
  __lowerCamelCase			:			Optional[Any]       			=					string.ascii_letters
  __lowerCamelCase			:			str       			=					string.ascii_lowercase[::-1] + string.ascii_uppercase[::-1]
  return "".join(
      letters_reversed[letters.index(_lowerCAmelCase			)] if c in letters else c for c in sequence			)

def 			a_	(				) -> None:
  from timeit import timeit

  print('Running performance benchmarks...'			)
  __lowerCamelCase			:			Tuple       			=					'from string import printable ; from __main__ import atbash, atbash_slow'
  print(F'> atbash_slow(): {timeit("atbash_slow(printable)"			,setup=_lowerCAmelCase			)} seconds'			)
  print(F'>      atbash(): {timeit("atbash(printable)"			,setup=_lowerCAmelCase			)} seconds'			)


if __name__ == "__main__":
   for example in ("ABCDEFGH", "123GGjj", "testStringtest", "with space"):
      print(f'''{example} encrypted in atbash: {atbash(example)}''')
   benchmark()






