#NEWLINE# @ region . cache_on_arguments ( expiration_time = EPISODE_EXPIRATION_TIME ) #NEWLINE# def get_episode_ids( self , show_id , season ) : #NEWLINE# #INDENT# 'Get episode ids from the show id and the season.\n\n        :param int show_id: show id.\n        :param int season: season of the episode.\n        :return: episode ids per episode number.\n        :rtype: dict\n\n        ' #NEWLINE# logger . info ( 'Getting the page of show id %d, season %d' , show_id , season ) #NEWLINE# r = self . session . get ( ( self . server_url + ( 'tvshow-%d-%d.html' % ( show_id , season ) ) ) , timeout = 10 ) #NEWLINE# soup = ParserBeautifulSoup ( r . content , [ 'lxml' , 'html.parser' ] ) #NEWLINE# episode_ids = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for row in soup . select ( 'table#table5 tr' ) : #NEWLINE# #INDENT# if ( not row ( 'a' , href = episode_id_re ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# cells = row ( 'td' ) #NEWLINE# episode = int ( cells [ 0 ] . text . split ( 'x' ) [ 1 ] ) #NEWLINE# episode_id = int ( cells [ 1 ] . a [ 'href' ] [ 8 : ( - 5 ) ] ) #NEWLINE# episode_ids [ episode ] = episode_id #NEWLINE# #UNINDENT# if episode_ids : #NEWLINE# #INDENT# logger . debug ( 'Found episode ids %r' , episode_ids ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . warning ( 'No episode ids found' ) #NEWLINE# #UNINDENT# return episode_ids