def getPlays(leporello_info): plays = [] # Initializing the Leporello Assistent with meta information for web scraping. # Lepistant.setInfo(leporello_info) leporelloFileNameOnDisk = Lepistant.createFilePath( Lepistant.REL_PATH_DOWNLOADS_FOLDER, Lepistant.FILE_NAME_LEPORELLO, 'leporello') soup = Lepistant.getSoup(leporello_info[URL_LEPORELLO], leporelloFileNameOnDisk) playItems = Lepistant.getTagsByClass(soup, 'div', leporello_info[CSS_CLASS_PLAY_ITEM]) leporello_info[PLAY_ITEMS] = playItems # Get only one play item for testing purposes # playItem = playItems[20] # WirAlleAnders playItem = playItems[12] # AltArmArbeitslos play = Play(playItem) play.link = Lepistant.getURLFromTagContent(playItem) formatted_title = Lepistant.removeNonAlphanumericCharacters(play.title) play.file_path_on_disk = Lepistant.REL_PATH_PLAYS_FOLDER + formatted_title + '/' play.file_name_on_disk = Lepistant.createFilePath( play.file_path_on_disk, play.title, 'html') soup = Lepistant.getSoup(play.link, play.file_name_on_disk) play.setPlayDetails(soup) plays.append(play) # for playItem in playItems: # logger.info('>>>>>>>>>>>>>>>>>>>>>>>> Fetching new play <<<<<<<<<<<<<<<<<<<<<<<<<') # play = Play(playItem) # play.link = Lepistant.getURLFromTagContent(playItem) # formatted_title = Lepistant.removeNonAlphanumericCharacters(play.title) # play.file_path_on_disk = Lepistant.REL_PATH_PLAYS_FOLDER + formatted_title + '/' # play.file_name_on_disk = Lepistant.createFilePath( # play.file_path_on_disk, # play.title, # 'html') # soup = Lepistant.getSoup(play.link, play.file_name_on_disk) # play.setPlayDetails(soup) # # logger.info('') # # plays.append(play) return plays
def getPlays(leporello_info): plays = [] # Initializing the Leporello Assistent with meta information for web scraping. # Lepistant.setInfo(leporello_info) leporelloFileNameOnDisk = Lepistant.createFilePath( Lepistant.REL_PATH_DOWNLOADS_FOLDER, Lepistant.FILE_NAME_LEPORELLO, 'leporello') soup = Lepistant.getSoup(leporello_info[URL_LEPORELLO], leporelloFileNameOnDisk) playItems = Lepistant.getTagsByClass( soup, 'div', leporello_info[CSS_CLASS_PLAY_ITEM]) leporello_info[PLAY_ITEMS] = playItems # Get only one play item for testing purposes # playItem = playItems[20] # WirAlleAnders playItem = playItems[12] # AltArmArbeitslos play = Play(playItem) play.link = Lepistant.getURLFromTagContent(playItem) formatted_title = Lepistant.removeNonAlphanumericCharacters(play.title) play.file_path_on_disk = Lepistant.REL_PATH_PLAYS_FOLDER + formatted_title + '/' play.file_name_on_disk = Lepistant.createFilePath( play.file_path_on_disk, play.title, 'html') soup = Lepistant.getSoup(play.link, play.file_name_on_disk) play.setPlayDetails(soup) plays.append(play) # for playItem in playItems: # logger.info('>>>>>>>>>>>>>>>>>>>>>>>> Fetching new play <<<<<<<<<<<<<<<<<<<<<<<<<') # play = Play(playItem) # play.link = Lepistant.getURLFromTagContent(playItem) # formatted_title = Lepistant.removeNonAlphanumericCharacters(play.title) # play.file_path_on_disk = Lepistant.REL_PATH_PLAYS_FOLDER + formatted_title + '/' # play.file_name_on_disk = Lepistant.createFilePath( # play.file_path_on_disk, # play.title, # 'html') # soup = Lepistant.getSoup(play.link, play.file_name_on_disk) # play.setPlayDetails(soup) # # logger.info('') # # plays.append(play) return plays
def getSpecificTheaterPlays(leporello_info, file_name, play_type, url): theater_plays = [] leporello_file_name_on_disk = Lepistant.createFilePath( Lepistant.REL_PATH_DOWNLOADS_FOLDER, file_name, 'html') soup = Lepistant.getSoup(url, leporello_file_name_on_disk) theater_play_items = Lepistant.getTagsByClass(soup, 'div', leporello_info[CSS_CLASS_PLAY_ITEM]) # for play_item in theater_play_items: # title = getTitleFromPlayItem(play_item) # theater_plays.append(title) for play_item in theater_play_items: logger.info('>>>>>>>>>>>>>>>>>>>>>>>> Fetching new play <<<<<<<<<<<<<<<<<<<<<<<<<') play = Play(play_item) play.setType(play_type) play.link = Lepistant.getURLFromTagContent(play_item) formatted_title = Lepistant.removeNonAlphanumericCharacters(play.title) play.file_path_on_disk = Lepistant.REL_PATH_PLAYS_FOLDER + formatted_title + '/' play.file_name_on_disk = Lepistant.createFilePath( play.file_path_on_disk, play.title, 'html') soup = Lepistant.getSoup(play.link, play.file_name_on_disk) play.setPlayDetails(soup) setDefaultTimeForPerformancesInPlay(play) logger.info('') theater_plays.append(play) return theater_plays
def getSpecificTheaterPlays(leporello_info, file_name, play_type, url): theater_plays = [] leporello_file_name_on_disk = Lepistant.createFilePath( Lepistant.REL_PATH_DOWNLOADS_FOLDER, file_name, 'html') soup = Lepistant.getSoup(url, leporello_file_name_on_disk) theater_play_items = Lepistant.getTagsByClass( soup, 'div', leporello_info[CSS_CLASS_PLAY_ITEM]) # for play_item in theater_play_items: # title = getTitleFromPlayItem(play_item) # theater_plays.append(title) for play_item in theater_play_items: logger.info( '>>>>>>>>>>>>>>>>>>>>>>>> Fetching new play <<<<<<<<<<<<<<<<<<<<<<<<<' ) play = Play(play_item) play.setType(play_type) play.link = Lepistant.getURLFromTagContent(play_item) formatted_title = Lepistant.removeNonAlphanumericCharacters( play.title) play.file_path_on_disk = Lepistant.REL_PATH_PLAYS_FOLDER + formatted_title + '/' play.file_name_on_disk = Lepistant.createFilePath( play.file_path_on_disk, play.title, 'html') soup = Lepistant.getSoup(play.link, play.file_name_on_disk) play.setPlayDetails(soup) setDefaultTimeForPerformancesInPlay(play) logger.info('') theater_plays.append(play) return theater_plays