public static List < Episode > getAllEpisodes ( String urlString , int season ) throws TvDbException { List < Episode > episodeList = new ArrayList <> ( ) ; Episode episode ; NodeList nlEpisode ; Node nEpisode ; Element eEpisode ; Document doc = DOMHelper . getEventDocFromUrl ( urlString ) ; nlEpisode = doc . getElementsByTagName ( EPISODE ) ; for ( int loop = 0 ; loop < nlEpisode . getLength ( ) ; loop ++ ) { nEpisode = nlEpisode . item ( loop ) ; if ( nEpisode . getNodeType ( ) == Node . ELEMENT_NODE ) { eEpisode = ( Element ) nEpisode ; episode = parseNextEpisode ( eEpisode ) ; if ( ( episode != null ) && ( season == - 1 || episode . getSeasonNumber ( ) == season ) ) { // Add the episode only if the season is -1 (all seasons) or matches the season episodeList . add ( episode ) ; } } } return episodeList ; }
Get all the episodes from the URL