###################################################################### # URL: https://github.com/alberanid/imdbpy # # install-best: pip install git+https://github.com/alberanid/imdbpy # # install: pip install imdbpy # ###################################################################### # Davide Alberani's most excellent module from imdb import IMDb import datetime import sys # lindsay wagner '0905993' # burt lancaster '0000044' # helen hunt '0000166' strPersonID = '0000166' # parameters are positional if len(sys.argv) < 2: print('\nThis script requires a person ID.\n') sys.exit() strPersonID= sys.argv[1] if len(sys.argv) < 3: print('\nUsing default output file: Filmography.htm') fileName = 'Filmography' else: fileName = sys.argv[2] # fetch an actor's filmography and dump to webpage with checkmark support def Create_Actor_Filmography(imdbID, webPageName): # create an instance of the IMDb class objIMDB = IMDb() # open the file objWebPage = open(webPageName + '.htm', 'w') # get a person - say, Lindsay Wagner ('0905993'). We just want the filmography object objActor = objIMDB.get_person(imdbID, 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(' |