

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__":
  lowercase_									=   '%20'.join(argv[1:]) if len(argv) > 1 else quote(str(input('Search: ')))

  print('Googling.....')

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

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

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

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

  webbrowser.open(link)





def      a      (			A__	:   str      ,   A__	:   bool = False     )    ->      str:





      """simple docstring"""



      if not isinstance(A__      ,   A__     ):
            _lowercase	       =F'''Expected string as input, found {type(A__     )}'''
            raise ValueError(A__     )
      if not isinstance(A__      ,   A__     ):
            _lowercase	       =F'''Expected boolean as use_pascal parameter, found {type(A__     )}'''
            raise ValueError(A__     )

      _lowercase	       =input_str.split('_'     )

      _lowercase	       =0 if use_pascal else 1

      _lowercase	       =words[start_index:]

      _lowercase	       =[word[0].upper() + word[1:] for word in words_to_capitalize]

      _lowercase	       ='' if use_pascal else words[0]

      return "".join([initial_word, *capitalized_words]     )


if __name__ == "__main__":
  from doctest import testmod

  testmod()


