###################################################################### # URL: https://github.com/alberanid/imdbpy # # install-best: pip install git+https://github.com/alberanid/imdbpy # # install: pip install imdbpy # # # # 08-14-2021: added support for actor's real names # # July 2021: created. # ###################################################################### # Davide Alberani's most excellent module, without which this script would # not be possible from imdb import IMDb import datetime import sys import argparse # first parameter is required; # second and third parameters are optional parser = argparse.ArgumentParser(description="Gets an actors filmography from the ImBD (Internet Movie Database)[http://www.imdb.com].") parser.add_argument("imdbID", type=str, help="Actor's ID (required)") parser.add_argument("-f", "--filename", type=str, default="Filmography", help="Alternate .HTM filename for output, default='Filmography") parser.add_argument("-r", "--realname", type=str, default="cornBunion", help="Actor's real name") lstCommandLine = parser.parse_args() if(lstCommandLine.realname != "cornBunion"): strRealName = '(' + lstCommandLine.realname + ')' else: strRealName = "()" # fetch an actor's filmography and dump to webpage with checkmark support def Create_Actor_Filmography(strImdbID, strWebPageName, strPersonRealName): # create an instance of the IMDb class objIMDB = IMDb() # open the file objWebPage = open(strWebPageName + '.htm', 'w') # get a person - say, Lindsay Wagner ('0905993'). We just want the filmography object objActor = objIMDB.get_person(strImdbID, info=['filmography']) # beginning tags objWebPage.writelines('' + '\n\n') objWebPage.writelines('' + '\n\n') objWebPage.writelines('
' + '\n') objWebPage.writelines('\tObtained | Movie |
---|---|
') try: objWebPage.writelines('%s [role: %s] (%s)' % (movie['title'], movie.currentRole, movie['year'])) except: objWebPage.writelines('%s [role: %s] [%s]' % (movie['title'], movie.currentRole, 'In Production')) objWebPage.writelines(' |