def episodes(season): """ return a list with the data for a season of Saturday Night Live episodes. The gathered dict will have the form: { "episodes": [ { "url": <string>, "date": <string> } ] } The returned data will have the format [ { "season": <int>, "episode": <int>, "url": <string> "air_date": <string> } ] """ url = season_url(season) dom = fetcher.get(url) if dom is None: print("failed to get season data") return else: return clean_episodes(season_page.gather(dom), season)
def profile(url): dom = fetcher.get(url) if dom is None: print("failed to get profile data") return else: data = profile_page.gather(dom) return clean_profile(data)
def profile(url): dom = fetcher.get(url) if dom is None: print("failed to get actor for url {}".format(url)) return data = actor_page.gather(dom) if data is None: print("failed to get data for actor at url {}".format(url)) return return clean_profile(data)
def episode_by_url(url): dom = fetcher.get(url) if dom is None: print("failed to get episode for url {}".format(url)) return data = episode_page.gather(dom) if data is None: print("failed to get data for episode at url {}".format(url)) return season, episode = parse_url(url) return clean_episode(season, episode, data)
def cast(season): """ return a dict with the data for a season of Saturday Night Live episodes. The gathered data will be broken into an array of casts. Each one will have a title describing which type of actors are listed in that array. { "casts": [ "members": [ { "description": <string> "actors": [ { "name": <string>, "profile": <string> } ] } ] ] } The repertory cast members will always be in a column which includes the word "Repertory" in it. For the purposes of this, cast members in any column that does not contain the word "Repertory" in its title will be considered "Featured Players". The return dict will have the form: { "repertory": [ { "name": <string>, "profile": <string> } ], "featured": [ { "name": <string>, "profile": <string> } ] } """ url = "https://en.wikipedia.org/wiki/Saturday_Night_Live_(season_{})".format( season) dom = fetcher.get(url) if dom is None: print("failed to get season data") return else: data = cast_page.gather(dom) return sort_actors(data.get("casts"))
def season(season, ): url = season_url(season) dom = fetcher.get(url) if dom is None: print("failed to get season for url {}".format(url)) return data = season_page.gather(dom) if data is None: print("failed to get data for season at url {}".format(url)) return return { "season": season, "episodes": data.get("episodes"), "cast_members": data.get("cast_members") }
def profile(actor_url): """ return a dict with the data for a season of Saturday Night Live episodes. The input dict will have the form: { "name": <string>, "birthdate": <string>, "hometown": <string>, "description": <string>, "roles": [ { "title": <string>, "url": <string>, "release": <string> } ] } and the returned dict will have the form: { "name": <string>, "birthdate": <date>, "hometown": <string>, "gender": <string>, "roles": [ { "title": <string>, "url": <string>, "release": <string> } ] } """ dom = fetcher.get(actor_url) if dom is None: print("failed to get season data") return else: return clean_profile(actor_page.gather(dom))
def all_cast(episode_url): """ return a dict with the data on the cast members that appeared in an episode of Saturday Night Live. The dict will have the form: { "actors": [ { "name": <string>, "profile": <string>, "description": <string> } ] } """ dom = fetcher.get(full_credits_url(episode_url)) if dom is None: print("failed to get episode cast data") return else: cast_data = cast_page.gather(dom) return [clean_actor(actor) for actor in cast_data.get("actors")]