




'''simple docstring'''






import bsa
import requests




def 		a_(			lowerCamelCase   )					->str:






       '''simple docstring'''




       return {
           "name": soup.ha.a.text,
           "genre": soup.find('''span''' ,					class_='''genre'''   ).text.strip(),
           "rating": soup.strong.text,
           "page_link": f"""https://www.imdb.com{soup.a.get('href'   )}""",
       }




def 		a_(			lowerCamelCase = 5   )					->str:






       '''simple docstring'''




       lowercase	:		Tuple    =   int(float(_lowerCamelCase   )   )
       if num_movies < 1:
              return ()
       lowercase	:		Tuple    =   (
           "https://www.imdb.com/search/title?title_type="
           f"""feature&sort=num_votes,desc&count={num_movies}"""
       )
       lowercase	:		Optional[int]    =   bsa.BeautifulSoup(requests.get(_lowerCamelCase   ).content ,					'''html.parser'''   )
       return tuple(
           get_movie_data_from_soup(_lowerCamelCase   )
           for movie in source.find_all('''div''' ,					class_='''lister-item mode-advanced'''   )   )


if __name__ == "__main__":
      import json

      lowercase						:   Union[str, Any]      						=							int(input('''How many movies would you like to see? '''))
      print(
          ''', '''.join(
              json.dumps(movie, indent=4) for movie in get_imdb_top_movies(num_movies)
          )
      )









def 						UpperCAmelCase (    _lowerCamelCase     ):
			return "".join(chr(ord(_lowerCamelCase     ) + 32     ) if "A" <= char <= "Z" else char for char in word     )


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

							testmod()