# Buggy code
def parse(self, data, mode):
    """
    Parse search results for items.

    :param data: The raw response from a search
    :param mode: The current mode used to search, e.g. RSS

    :return: A list of items found
    """
    items = []

    with BS4Parser(data, "html5lib") as html:
        torrent_table = html.find("div", class_="panel-body")
        torrent_rows = torrent_table("tr") if torrent_table else []

        # Continue only if at least one release is found
        if len(torrent_rows) < 2:
            log.debug("Data returned from provider does not contain any torrents")
            return items

        # Skip column headers
        for row in torrent_rows[1:]:
            cells = row("td")

            try:
                title = cells[1].find("a").get_text()
                magnet = cells[2].find("a", title="Magnet link")["href"]
                download_url = "{magnet}{trackers}".format(
                    magnet=magnet, trackers=self._custom_trackers
                )
                if not all([title, download_url]):
                    continue

                seeders = 1
                leechers = 0
                if len(cells) > 5:
                    peers = cells[5].find("div")
                    if peers and peers.get("title"):
                        peers = peers["title"].replace(",", "").split(" | ", 1)
                        # Removes 'Seeders: '
                        seeders = try_int(peers[0][9:])
                        # Removes 'Leechers: '
                        leechers = try_int(peers[1][10:])

                # Filter unseeded torrent
                if seeders < min(self.minseed, 1):
                    if mode != "RSS":
                        log.debug(
                            "Discarding torrent because it doesn't meet the"
                            " minimum seeders: {0}. Seeders: {1}",
                            title,
                            seeders,
                        )
                    continue

                torrent_size = cells[3].get_text().replace(",", "")
                size = convert_size(torrent_size) or -1

                pubdate_raw = cells[4].get_text()
                # "long ago" can't be translated to a date
                if pubdate_raw == "long ago":
                    pubdate_raw = None
                pubdate = self.parse_pubdate(pubdate_raw, human_time=True)

                item = {
                    "title": title,
                    "link": download_url,
                    "size": size,
                    "seeders": seeders,
                    "leechers": leechers,
                    "pubdate": pubdate,
                }
                if mode != "RSS":
                    log.debug(
                        "Found result: {0} with {1} seeders and {2} leechers",
                        title,
                        seeders,
                        leechers,
                    )

                items.append(item)
            except (AttributeError, TypeError, KeyError, ValueError, IndexError):
                log.error(
                    "Failed parsing provider. Traceback: {0!r}", traceback.format_exc()
                )

    return items


# Traceback (AttributeError)
2016-12-02 19:05:00 INFO     FINDPROPERS :: [Rarbg] :: [1d6c65b] Searching for any new PROPER releases from Rarbg
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] GET URL: http://torrentapi.org/pubapi_v2.php?get_token=get_token&amp;app_id=medusa&amp;format=json [Status: 200]
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] Search mode: Episode
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] Unknown exception while searching for propers in Rarbg, skipping: 'NoneType' object has no attribute 'indexer'
2016-12-02 19:05:01 DEBUG    FINDPROPERS :: [Rarbg] :: [1d6c65b] Traceback (most recent call last):
File "C:/Users/Fernando/Documents/Medusa\medusa\search\proper.py", line 137, in _get_proper_results
cur_propers = cur_provider.find_propers(recently_aired)
File "C:/Users/Fernando/Documents/Medusa\medusa\providers\generic_provider.py", line 148, in find_propers
for item in self.search(search_strings[0], ep_obj=episode_obj):
File "C:/Users/Fernando/Documents/Medusa\medusa\providers\torrent\json\rarbg.py", line 99, in search
search_params['search_tvdb'] = self._get_tvdb_id()
File "C:/Users/Fernando/Documents/Medusa\medusa\providers\generic_provider.py", line 486, in _get_tvdb_id
return self.show.indexerid if self.show.indexer == INDEXER_TVDBV2 else self.show.externals.get('tvdb_id')
AttributeError: 'NoneType' object has no attribute 'indexer'

# Fixed code
def parse(self, data, mode):
    """
    Parse search results for items.

    :param data: The raw response from a search
    :param mode: The current mode used to search, e.g. RSS

    :return: A list of items found
    """
    items = []

    with BS4Parser(data, "html5lib") as html:
        torrent_table = html.find("div", class_="panel-body")
        torrent_rows = torrent_table("tr") if torrent_table else []

        # Continue only if at least one release is found
        if len(torrent_rows) < 2:
            log.debug("Data returned from provider does not contain any torrents")
            return items

        # Skip column headers
        for row in torrent_rows[1:]:
            cells = row("td")

            try:
                title = cells[1].find("a").get_text()
                magnet = cells[2].find("a", title="Magnet link")["href"]
                download_url = "{magnet}{trackers}".format(
                    magnet=magnet, trackers=self._custom_trackers
                )
                if not all([title, download_url]):
                    continue

                seeders = 1
                leechers = 0
                if len(cells) > 5:
                    peers = cells[5].find("div")
                    if peers and peers.get("title"):
                        peers = peers["title"].replace(",", "").split(" | ", 1)
                        # Removes 'Seeders: '
                        seeders = try_int(peers[0][9:])
                        # Removes 'Leechers: '
                        leechers = try_int(peers[1][10:])

                # Filter unseeded torrent
                if seeders < min(self.minseed, 1):
                    if mode != "RSS":
                        log.debug(
                            "Discarding torrent because it doesn't meet the"
                            " minimum seeders: {0}. Seeders: {1}",
                            title,
                            seeders,
                        )
                    continue

                torrent_size = cells[3].get_text().replace(",", "")
                size = convert_size(torrent_size) or -1

                pubdate_raw = cells[4].get_text().replace("yesterday", "24 hours")
                # "long ago" can't be translated to a date
                if pubdate_raw == "long ago":
                    pubdate_raw = None
                pubdate = self.parse_pubdate(pubdate_raw, human_time=True)

                item = {
                    "title": title,
                    "link": download_url,
                    "size": size,
                    "seeders": seeders,
                    "leechers": leechers,
                    "pubdate": pubdate,
                }
                if mode != "RSS":
                    log.debug(
                        "Found result: {0} with {1} seeders and {2} leechers",
                        title,
                        seeders,
                        leechers,
                    )

                items.append(item)
            except (AttributeError, TypeError, KeyError, ValueError, IndexError):
                log.error(
                    "Failed parsing provider. Traceback: {0!r}", traceback.format_exc()
                )

    return items