# Buggy code
def _get_favorites_entries(self, task, config):
    email = config.get("email")
    max_age = config.get("max_episode_age_days")

    log.info("Retrieving npo.nl favorite series for %s", email)
    response = self._get_page(task, config, "https://mijn.npo.nl/profiel/favorieten")
    page = get_soup(response.content)

    entries = list()
    for list_item in page.findAll("div", class_="thumb-item"):
        url = list_item.find("a")["href"]

        if url == "/profiel/favorieten/favorieten-toevoegen":
            log.debug("Skipping 'add favorite' button")
            continue

        url = self._prefix_url("https://mijn.npo.nl", url)
        series_name = next(
            list_item.find("div", class_="thumb-item__title").stripped_strings
        )

        last_aired_text = list_item.find("div", class_="thumb-item__subtitle").text
        last_aired_text = last_aired_text.rsplit("Laatste aflevering ")[-1]
        last_aired = self._parse_date(last_aired_text)

        if last_aired is None:
            log.info("Series %s did not yet start", series_name)
            continue
        elif max_age >= 0 and (date.today() - last_aired) > timedelta(days=max_age):
            log.debug("Skipping %s, last aired on %s", series_name, last_aired)
            continue
        elif (date.today() - last_aired) > timedelta(days=365 * 2):
            log.info("Series %s last aired on %s", series_name, last_aired)

        series_info = self._get_series_info(task, config, series_name, url)

        entries += self._get_series_episodes(
            task, config, series_name, url, series_info
        )

    return entries


# Traceback (AttributeError)
2017-07-05 20:31 CRITICAL task tv-journaal BUG: Unhandled error in plugin npo_watchlist: 'NoneType' object has no attribute 'find'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flexget/task.py", line 486, in __run_plugin
return method(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flexget/event.py", line 23, in call
return self.func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/input/npo_watchlist.py", line 326, in on_task_input
entries += self._get_favorites_entries(task, config)
File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/input/npo_watchlist.py", line 318, in _get_favorites_entries
series_info = self._get_series_info(task, config, series_name, url)
File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/input/npo_watchlist.py", line 180, in _get_series_info
series_info['npo_url'] = tvseries.find('a', itemprop='url')['href']
AttributeError: 'NoneType' object has no attribute 'find'

# Fixed code
def _get_favorites_entries(self, task, config, page):
    max_age = config.get("max_episode_age_days")
    if max_age >= 3:
        log.warning(
            "If max_episode_age_days is 3 days or more, the plugin will still check all series"
        )
    elif max_age > -1:
        return self._get_recent_entries(task, config, page)

    series = page.find("div", attrs={"id": "component-grid-favourite-series"})

    entries = list()
    for list_item in series.findAll("div", class_="npo-ankeiler-tile-container"):
        url = list_item.find("a")["href"]
        series_name = next(list_item.find("h2").stripped_strings)

        entries += self._get_series_episodes(task, config, series_name, url)

    return entries