# 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_rows = html.find("div", id="torrenttable").find_all("tr")

        # 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

        # Scenetime apparently uses different number of cells in #torrenttable based
        # on who you are. This works around that by extracting labels from the first
        # <tr> and using their index to find the correct download/seeders/leechers td.
        labels = [
            label.get_text(strip=True) or label.img["title"]
            for label in torrent_rows[0]("td")
        ]

        # Skip column headers
        for row in torrent_rows[1:]:
            cells = row("td")
            if len(cells) < len(labels):
                continue

            try:
                link = cells[labels.index("Name")]
                torrent_id = (
                    link.find("a")["href"].replace("details.php?id=", "").split("&")[0]
                )
                title = link.find("a").get_text(strip=True)
                download_url = self.urls["download"].format(
                    torrent_id, "{0}.torrent".format(title.replace(" ", "."))
                )
                if not all([title, download_url]):
                    continue

                seeders = try_int(cells[labels.index("Seeders")].get_text(strip=True))
                leechers = try_int(cells[labels.index("Leechers")].get_text(strip=True))

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

                torrent_size = cells[labels.index("Size")].get_text()
                torrent_size = re.sub(r"(\d+\.?\d*)", r"\1 ", torrent_size)
                size = convert_size(torrent_size) or -1

                # Get the last item from the "span" list to avoid parsing "NEW!" as a pub date.
                pubdate_raw = link.find_all("span")[-1]["title"]
                pubdate = self.parse_pubdate(pubdate_raw)

                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.exception("Failed parsing provider.")

    return items


# Traceback (AttributeError)
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Unable to match Homes.Under.The.Hammer.S22E02.HDTV.x264-NORiTE[rartv] to a series in your database. Parser result: title: Homes Under The Hammer, season: 22, episode: [2], source: HDTV, video_codec: H.264, video_encoder: x264, release_group: NORiTE, type: episode, parsing_time: 0.16429615020751953, absolute_episode: [], quality: SDTV, total_time: 0.1729259490966797
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Converted parsed result Ransom.S03.WEBRip.x264-ION10 into title: Ransom, season: 3, source: Web, other: Rip, video_codec: H.264, video_encoder: x264, release_group: ION10, type: episode, parsing_time: 0.1428971290588379, episode: [], absolute_episode: [], quality: SDTV, total_time: None
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Matched release Ransom.S03.WEBRip.x264-ION10 to a series in your database: Ransom
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Parsed Ransom.S03.WEBRip.x264-ION10 into title: Ransom, season: 3, source: Web, other: Rip, video_codec: H.264, video_encoder: x264, release_group: ION10, type: episode, parsing_time: 0.1428971290588379, episode: [], absolute_episode: [], quality: SDTV, total_time: 0.1460866928100586
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Added item: Ransom.S03.WEBRip.x264-ION10 to cache: rarbg with url: magnet:?xt=urn:btih:d4a1f5450c852256fdc92250359163e62f04f2f7&dn=Ransom.S03.WEBRip.x264-ION10&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp://95.213.191.124:2710/announce&tr=udp://tracker.coppersurfer.tk:6969/announce&tr=udp://tracker.leechers-paradise.org:6969/announce&tr=udp://tracker.zer0day.to:1337/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=http://tracker.opentrackr.org:1337/announce&tr=udp://p4p.arenabg.com:1337/announce&tr=http://p4p.arenabg.com:1337/announce&tr=udp://explodie.org:6969/announce&tr=udp://9.rarbg.com:2710/announce&tr=http://explodie.org:6969/announce&tr=http://tracker.dler.org:6969/announce&tr=udp://public.popcorn-tracker.org:6969/announce&tr=udp://tracker.internetwarriors.net:1337/announce&tr=udp://ipv4.tracker.harry.lu:80/announce&tr=http://ipv4.tracker.harry.lu:80/announce&tr=udp://mgtracker.org:2710/announce&tr=http://mgtracker.org:6969/announce&tr=udp://tracker.mg64.net:6969/announce&tr=http://tracker.mg64.net:6881/announce&tr=http://torrentsmd.com:8080/announce&tr=http://87.248.186.252:8080/announce&tr=http://tracker.skyts.net:6969/announce&tr=udp://bt.xxx-tracker.com:2710/announce&tr=http://tracker1.wasabii.com.tw:6969/announce&tr=http://tracker.grepler.com:6969/announce&tr=udp://tracker.grepler.com:6969/announce&tr=http://tracker.tiny-vps.com:6969/announce&tr=udp://tracker.vanitycore.co:6969/announce&tr=udp://tracker.tiny-vps.com:6969/announce&tr=http://tracker2.wasabii.com.tw:6969/announce&tr=http://tracker.vanitycore.co:6969/announce&tr=udp://tracker.tordb.ml:6881/announce&tr=http://tracker.tordb.ml:6881/announce&tr=udp://tracker.filetracker.pl:8089/announce&tr=http://tracker.filetracker.pl:8089/announce&tr=udp://tracker.desu.sh:6969/announce&tr=http://tracker.kuroy.me:5944/announce&tr=http://retracker.gorcomnet.ru:80/announce&tr=udp://tracker.kuroy.me:5944/announce&tr=http://tracker.edoardocolombo.eu:6969/announce&tr=http://tracker.baravik.org:6970/announce&tr=http://0123456789nonexistent.com:80/announce&tr=udp://tracker.piratepublic.com:1337/announce&tr=udp://tracker.edoardocolombo.eu:6969/announce&tr=udp://91.218.230.81:6969/announce&tr=http://open.acgtracker.com:1096/announce&tr=http://91.218.230.81:6969/announce&tr=udp://zephir.monocul.us:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce&tr=udp://tracker.sith.su:80/announce&tr=udp://open.stealth.si:80/announce&tr=udp://208.67.16.113:8000/announce&tr=http://tracker.tfile.me:80/announce&tr=http://concen.org:6969/announce
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Converted parsed result Ransom.S03.1080p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] into title: Ransom, season: 3, screen_size: 1080p, streaming_service: Amazon Prime, source: Web, other: Rip, audio_codec: Dolby Digital Plus, audio_channels: 5.1, video_codec: H.264, video_encoder: x264, release_group: NTb, type: episode, parsing_time: 0.2115797996520996, episode: [], absolute_episode: [], quality: 1080p WEB-DL, total_time: None
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Matched release Ransom.S03.1080p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] to a series in your database: Ransom
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Parsed Ransom.S03.1080p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] into title: Ransom, season: 3, screen_size: 1080p, streaming_service: Amazon Prime, source: Web, other: Rip, audio_codec: Dolby Digital Plus, audio_channels: 5.1, video_codec: H.264, video_encoder: x264, release_group: NTb, type: episode, parsing_time: 0.2115797996520996, episode: [], absolute_episode: [], quality: 1080p WEB-DL, total_time: 0.21459221839904785
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Added item: Ransom.S03.1080p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] to cache: rarbg with url: magnet:?xt=urn:btih:2ce8043dc1e3b7bced9466c97c7f04525c76fd55&dn=Ransom.S03.1080p.AMZN.WEBRip.DDP5.1.x264-NTb%5Brartv%5D&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp://95.213.191.124:2710/announce&tr=udp://tracker.coppersurfer.tk:6969/announce&tr=udp://tracker.leechers-paradise.org:6969/announce&tr=udp://tracker.zer0day.to:1337/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=http://tracker.opentrackr.org:1337/announce&tr=udp://p4p.arenabg.com:1337/announce&tr=http://p4p.arenabg.com:1337/announce&tr=udp://explodie.org:6969/announce&tr=udp://9.rarbg.com:2710/announce&tr=http://explodie.org:6969/announce&tr=http://tracker.dler.org:6969/announce&tr=udp://public.popcorn-tracker.org:6969/announce&tr=udp://tracker.internetwarriors.net:1337/announce&tr=udp://ipv4.tracker.harry.lu:80/announce&tr=http://ipv4.tracker.harry.lu:80/announce&tr=udp://mgtracker.org:2710/announce&tr=http://mgtracker.org:6969/announce&tr=udp://tracker.mg64.net:6969/announce&tr=http://tracker.mg64.net:6881/announce&tr=http://torrentsmd.com:8080/announce&tr=http://87.248.186.252:8080/announce&tr=http://tracker.skyts.net:6969/announce&tr=udp://bt.xxx-tracker.com:2710/announce&tr=http://tracker1.wasabii.com.tw:6969/announce&tr=http://tracker.grepler.com:6969/announce&tr=udp://tracker.grepler.com:6969/announce&tr=http://tracker.tiny-vps.com:6969/announce&tr=udp://tracker.vanitycore.co:6969/announce&tr=udp://tracker.tiny-vps.com:6969/announce&tr=http://tracker2.wasabii.com.tw:6969/announce&tr=http://tracker.vanitycore.co:6969/announce&tr=udp://tracker.tordb.ml:6881/announce&tr=http://tracker.tordb.ml:6881/announce&tr=udp://tracker.filetracker.pl:8089/announce&tr=http://tracker.filetracker.pl:8089/announce&tr=udp://tracker.desu.sh:6969/announce&tr=http://tracker.kuroy.me:5944/announce&tr=http://retracker.gorcomnet.ru:80/announce&tr=udp://tracker.kuroy.me:5944/announce&tr=http://tracker.edoardocolombo.eu:6969/announce&tr=http://tracker.baravik.org:6970/announce&tr=http://0123456789nonexistent.com:80/announce&tr=udp://tracker.piratepublic.com:1337/announce&tr=udp://tracker.edoardocolombo.eu:6969/announce&tr=udp://91.218.230.81:6969/announce&tr=http://open.acgtracker.com:1096/announce&tr=http://91.218.230.81:6969/announce&tr=udp://zephir.monocul.us:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce&tr=udp://tracker.sith.su:80/announce&tr=udp://open.stealth.si:80/announce&tr=udp://208.67.16.113:8000/announce&tr=http://tracker.tfile.me:80/announce&tr=http://concen.org:6969/announce
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Converted parsed result Ransom.S03.720p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] into title: Ransom, season: 3, screen_size: 720p, streaming_service: Amazon Prime, source: Web, other: Rip, audio_codec: Dolby Digital Plus, audio_channels: 5.1, video_codec: H.264, video_encoder: x264, release_group: NTb, type: episode, parsing_time: 0.20414113998413086, episode: [], absolute_episode: [], quality: 720p WEB-DL, total_time: None
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Matched release Ransom.S03.720p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] to a series in your database: Ransom
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Parsed Ransom.S03.720p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] into title: Ransom, season: 3, screen_size: 720p, streaming_service: Amazon Prime, source: Web, other: Rip, audio_codec: Dolby Digital Plus, audio_channels: 5.1, video_codec: H.264, video_encoder: x264, release_group: NTb, type: episode, parsing_time: 0.20414113998413086, episode: [], absolute_episode: [], quality: 720p WEB-DL, total_time: 0.2071671485900879
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Added item: Ransom.S03.720p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] to cache: rarbg with url: magnet:?xt=urn:btih:89954657d97dbead8a030e4b2bfcd741d3a3df9e&dn=Ransom.S03.720p.AMZN.WEBRip.DDP5.1.x264-NTb%5Brartv%5D&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp://95.213.191.124:2710/announce&tr=udp://tracker.coppersurfer.tk:6969/announce&tr=udp://tracker.leechers-paradise.org:6969/announce&tr=udp://tracker.zer0day.to:1337/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=http://tracker.opentrackr.org:1337/announce&tr=udp://p4p.arenabg.com:1337/announce&tr=http://p4p.arenabg.com:1337/announce&tr=udp://explodie.org:6969/announce&tr=udp://9.rarbg.com:2710/announce&tr=http://explodie.org:6969/announce&tr=http://tracker.dler.org:6969/announce&tr=udp://public.popcorn-tracker.org:6969/announce&tr=udp://tracker.internetwarriors.net:1337/announce&tr=udp://ipv4.tracker.harry.lu:80/announce&tr=http://ipv4.tracker.harry.lu:80/announce&tr=udp://mgtracker.org:2710/announce&tr=http://mgtracker.org:6969/announce&tr=udp://tracker.mg64.net:6969/announce&tr=http://tracker.mg64.net:6881/announce&tr=http://torrentsmd.com:8080/announce&tr=http://87.248.186.252:8080/announce&tr=http://tracker.skyts.net:6969/announce&tr=udp://bt.xxx-tracker.com:2710/announce&tr=http://tracker1.wasabii.com.tw:6969/announce&tr=http://tracker.grepler.com:6969/announce&tr=udp://tracker.grepler.com:6969/announce&tr=http://tracker.tiny-vps.com:6969/announce&tr=udp://tracker.vanitycore.co:6969/announce&tr=udp://tracker.tiny-vps.com:6969/announce&tr=http://tracker2.wasabii.com.tw:6969/announce&tr=http://tracker.vanitycore.co:6969/announce&tr=udp://tracker.tordb.ml:6881/announce&tr=http://tracker.tordb.ml:6881/announce&tr=udp://tracker.filetracker.pl:8089/announce&tr=http://tracker.filetracker.pl:8089/announce&tr=udp://tracker.desu.sh:6969/announce&tr=http://tracker.kuroy.me:5944/announce&tr=http://retracker.gorcomnet.ru:80/announce&tr=udp://tracker.kuroy.me:5944/announce&tr=http://tracker.edoardocolombo.eu:6969/announce&tr=http://tracker.baravik.org:6970/announce&tr=http://0123456789nonexistent.com:80/announce&tr=udp://tracker.piratepublic.com:1337/announce&tr=udp://tracker.edoardocolombo.eu:6969/announce&tr=udp://91.218.230.81:6969/announce&tr=http://open.acgtracker.com:1096/announce&tr=http://91.218.230.81:6969/announce&tr=udp://zephir.monocul.us:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce&tr=udp://tracker.sith.su:80/announce&tr=udp://open.stealth.si:80/announce&tr=udp://208.67.16.113:8000/announce&tr=http://tracker.tfile.me:80/announce&tr=http://concen.org:6969/announce
2019-05-26 11:01:16 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Unable to match My.Little.Pony.Friendship.is.Magic.S09E09.WEB-DL.x264-ION10 to a series in your database. Parser result: title: My Little Pony Friendship is Magic, season: 9, episode: [9], source: Web, video_codec: H.264, video_encoder: x264, release_group: ION10, type: episode, parsing_time: 0.18118596076965332, absolute_episode: [], quality: SDTV, total_time: 0.1907637119293213
2019-05-26 11:01:17 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Unable to match My.Little.Pony.Friendship.is.Magic.S09E09.Sweet.and.Smoky.720p.WEB-DL.DD5.1.H264-iT00NZ[rartv] to a series in your database. Parser result: title: My Little Pony Friendship is Magic, season: 9, episode: [9], episode_title: Sweet and Smoky, screen_size: 720p, source: Web, audio_codec: AC3, audio_channels: 5.1, video_codec: H.264, release_group: iT00NZ, type: episode, parsing_time: 0.23082780838012695, absolute_episode: [], quality: 720p WEB-DL, total_time: 0.23978900909423828
2019-05-26 11:01:17 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Hit old cached items, not parsing any more for: rarbg
2019-05-26 11:01:17 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Rarbg] :: [429bbf9] Transaction with 3 queries executed
2019-05-26 11:01:17 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Updating providers cache
2019-05-26 11:01:17 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Search mode: RSS
2019-05-26 11:01:18 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] GET URL: https://alpharatio.cc/torrents.php?searchstr=&filter_cat%5B1%5D=1&filter_cat%5B2%5D=1&filter_cat%5B3%5D=1&filter_cat%5B4%5D=1&filter_cat%5B5%5D=1 [Status: 200]
2019-05-26 11:01:18 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] User-Agent: Medusa/0.3.1 (Linux; 4.9.35-v7+; 3ee79d80-7b55-11e9-aa0d-b827eb6b4d4c)
2019-05-26 11:01:19 INFO     SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Removing cache entries older than 15 days from alpharatio
2019-05-26 11:01:20 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Unable to match Suncorp.Super.Netball.2019.Round.5.Vixens.vs.Swifts.WEB.H264-LASTPLACE to a series in your database. Parser result: title: Suncorp Super Netball, year: 2019, season: 2019, episode_title: Round, episode: [5], source: Web, video_codec: H.264, release_group: LASTPLACE, type: episode, parsing_time: 0.16698503494262695, absolute_episode: [], quality: SDTV, total_time: 0.17520713806152344
2019-05-26 11:01:20 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Unable to match Junjou.Romantica.S02E12.1080p.BluRay.x264-ANiHLS to a series in your database. Parser result: title: Junjou Romantica, season: 2, episode: [12], screen_size: 1080p, source: Blu-ray, video_codec: H.264, video_encoder: x264, release_group: ANiHLS, type: episode, parsing_time: 0.18963909149169922, absolute_episode: [], quality: 1080p BluRay, total_time: 0.19742274284362793
2019-05-26 11:01:20 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Unable to match Junjou.Romantica.S02E10.1080p.BluRay.x264-ANiHLS to a series in your database. Parser result: title: Junjou Romantica, season: 2, episode: [10], screen_size: 1080p, source: Blu-ray, video_codec: H.264, video_encoder: x264, release_group: ANiHLS, type: episode, parsing_time: 0.18993830680847168, absolute_episode: [], quality: 1080p BluRay, total_time: 0.19774627685546875
2019-05-26 11:01:20 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Unable to match Junjou.Romantica.S02E09.1080p.BluRay.x264-ANiHLS to a series in your database. Parser result: title: Junjou Romantica, season: 2, episode: [9], screen_size: 1080p, source: Blu-ray, video_codec: H.264, video_encoder: x264, release_group: ANiHLS, type: episode, parsing_time: 0.19181394577026367, absolute_episode: [], quality: 1080p BluRay, total_time: 0.19965362548828125
2019-05-26 11:01:21 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Unable to match Junjou.Romantica.S02E08.1080p.BluRay.x264-ANiHLS to a series in your database. Parser result: title: Junjou Romantica, season: 2, episode: [8], screen_size: 1080p, source: Blu-ray, video_codec: H.264, video_encoder: x264, release_group: ANiHLS, type: episode, parsing_time: 0.19384074211120605, absolute_episode: [], quality: 1080p BluRay, total_time: 0.20160269737243652
2019-05-26 11:01:21 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [AlphaRatio] :: [429bbf9] Hit old cached items, not parsing any more for: alpharatio
2019-05-26 11:01:21 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Updating providers cache
2019-05-26 11:01:21 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Search mode: RSS
2019-05-26 11:01:21 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] GET URL: https://speed.cd/browse.php?c2=1&c30=1&c41=1&c49=1&c50=1&c52=1&c55=1&search= [Status: 200]
2019-05-26 11:01:21 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] User-Agent: Medusa/0.3.1 (Linux; 4.9.35-v7+; 3ee79d80-7b55-11e9-aa0d-b827eb6b4d4c)
2019-05-26 11:01:23 INFO     SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Removing cache entries older than 15 days from speedcd
2019-05-26 11:01:24 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match University.Challenge.S25E30.480p.x264-mSD to a series in your database. Parser result: title: University Challenge, season: 25, episode: [30], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.1747889518737793, absolute_episode: [], quality: SDTV, total_time: 0.18304157257080078
2019-05-26 11:01:24 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Crimewatch.Roadshow.S10E33.480p.x264-mSD to a series in your database. Parser result: title: Crimewatch Roadshow, season: 10, episode: [33], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.17543792724609375, absolute_episode: [], quality: SDTV, total_time: 0.1835641860961914
2019-05-26 11:01:24 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match The.Kitchen.S21E03.Sizzling.Summer.720p.HEVC.x265-MeGusta to a series in your database. Parser result: title: The Kitchen, season: 21, episode: [3], episode_title: Sizzling Summer, screen_size: 720p, video_codec: H.265, video_profile: High Efficiency Video Coding, video_encoder: x265, release_group: MeGusta, type: episode, parsing_time: 0.18923544883728027, absolute_episode: [], quality: 720p HDTV, total_time: 0.19747209548950195
2019-05-26 11:01:24 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Only.Connect.S14E19.480p.x264-mSD to a series in your database. Parser result: title: Only Connect, season: 14, episode: [19], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.17314672470092773, absolute_episode: [], quality: SDTV, total_time: 0.18135786056518555
2019-05-26 11:01:24 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Homes.Under.The.Hammer.S22E02.HDTV.x264-NORiTE to a series in your database. Parser result: title: Homes Under The Hammer, season: 22, episode: [2], source: HDTV, video_codec: H.264, video_encoder: x264, release_group: NORiTE, type: episode, parsing_time: 0.16995620727539062, absolute_episode: [], quality: SDTV, total_time: 0.17815446853637695
2019-05-26 11:01:25 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Antiques.Road.Trip.S18E08.480p.x264-mSD to a series in your database. Parser result: title: Antiques Road Trip, season: 18, episode: [8], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.17907071113586426, absolute_episode: [], quality: SDTV, total_time: 0.18728184700012207
2019-05-26 11:01:25 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Jungle.Gold.S02E04.1080p.HEVC.x265-MeGusta to a series in your database. Parser result: title: Jungle Gold, season: 2, episode: [4], screen_size: 1080p, video_codec: H.265, video_profile: High Efficiency Video Coding, video_encoder: x265, release_group: MeGusta, type: episode, parsing_time: 0.1911754608154297, absolute_episode: [], quality: 1080p HDTV, total_time: 0.19933319091796875
2019-05-26 11:01:25 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Crimewatch.Roadshow.S10E35.480p.x264-mSD to a series in your database. Parser result: title: Crimewatch Roadshow, season: 10, episode: [35], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.17586946487426758, absolute_episode: [], quality: SDTV, total_time: 0.18416118621826172
2019-05-26 11:01:25 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Doctors.S20E28.XviD-AFG to a series in your database. Parser result: title: Doctors, season: 20, episode: [28], video_codec: Xvid, release_group: AFG, type: episode, parsing_time: 0.1266334056854248, absolute_episode: [], quality: Unknown, total_time: 0.13480043411254883
2019-05-26 11:01:25 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Dancing.With.The.Stars.NZ.S08E12.480p.x264-mSD to a series in your database. Parser result: title: Dancing With The Stars NZ, season: 8, episode: [12], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.1783599853515625, absolute_episode: [], quality: SDTV, total_time: 0.18662023544311523
2019-05-26 11:01:25 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Greta.2018.720p.BRRip.x264.AC3-DiVERSiTY to a series in your database. Parser result: title: Greta, year: 2018, screen_size: 720p, other: ['Reencoded', 'Rip'], source: BRRip, video_codec: H.264, video_encoder: x264, audio_codec: AC3, release_group: DiVERSiTY, type: episode, parsing_time: 0.18768858909606934, season: None, episode: [], absolute_episode: [], quality: 720p BluRay, total_time: 0.19564509391784668
2019-05-26 11:01:26 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Rip.Off.Britain.Holidays.S07E10.XviD-AFG to a series in your database. Parser result: title: Rip Off Britain Holidays, season: 7, episode: [10], video_codec: Xvid, release_group: AFG, type: episode, parsing_time: 0.13573694229125977, absolute_episode: [], quality: Unknown, total_time: 0.14391422271728516
2019-05-26 11:01:26 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match The.Project.2019.05.20.720p.HEVC.x265-MeGusta to a series in your database. Parser result: title: The Project, date: 2019-05-20, screen_size: 720p, video_codec: H.265, video_profile: High Efficiency Video Coding, video_encoder: x265, release_group: MeGusta, type: episode, parsing_time: 0.21525931358337402, season: None, episode: [], absolute_episode: [], quality: 720p HDTV, total_time: 0.2235097885131836
2019-05-26 11:01:26 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Polterheist.2018.HDRip.XviD.AC3-EVO to a series in your database. Parser result: title: Polterheist, year: 2018, other: ['HD', 'Rip'], video_codec: Xvid, audio_codec: AC3, release_group: EVO, type: episode, parsing_time: 0.13920903205871582, season: None, episode: [], absolute_episode: [], quality: Unknown, total_time: 0.14735794067382812
2019-05-26 11:01:26 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Caught.Red.Handed.UK.S07E12.480p.x264-mSD to a series in your database. Parser result: title: Caught Red Handed, alias: Caught Red Handed UK, country: GB, season: 7, episode: [12], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.18285775184631348, absolute_episode: [], quality: SDTV, total_time: 0.19109392166137695
2019-05-26 11:01:26 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Football.Serie.A.2019.05.25.Frosinone.vs.Chievo.XviD-AFG to a series in your database. Parser result: title: Football Serie A, date: 2019-05-25, episode_title: Frosinone vs Chievo, video_codec: Xvid, release_group: AFG, type: episode, parsing_time: 0.1662447452545166, season: None, episode: [], absolute_episode: [], quality: Unknown, total_time: 0.1744375228881836
2019-05-26 11:01:27 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Rip.Off.Britain.Holidays.S07E10.720p.HDTV.x264-DOCERE to a series in your database. Parser result: title: Rip Off Britain Holidays, season: 7, episode: [10], screen_size: 720p, source: HDTV, video_codec: H.264, video_encoder: x264, release_group: DOCERE, type: episode, parsing_time: 0.1864337921142578, absolute_episode: [], quality: 720p HDTV, total_time: 0.19420671463012695
2019-05-26 11:01:27 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Doctors.S20E28.720p.HDTV.x264-NORiTE to a series in your database. Parser result: title: Doctors, season: 20, episode: [28], screen_size: 720p, source: HDTV, video_codec: H.264, video_encoder: x264, release_group: NORiTE, type: episode, parsing_time: 0.1782383918762207, absolute_episode: [], quality: 720p HDTV, total_time: 0.1860060691833496
2019-05-26 11:01:27 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Rip.Off.Britain.Holidays.S07E10.HDTV.x264-DOCERE to a series in your database. Parser result: title: Rip Off Britain Holidays, season: 7, episode: [10], source: HDTV, video_codec: H.264, video_encoder: x264, release_group: DOCERE, type: episode, parsing_time: 0.1578807830810547, absolute_episode: [], quality: SDTV, total_time: 0.16604161262512207
2019-05-26 11:01:27 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Antiques.Road.Trip.S18E10.XviD-AFG to a series in your database. Parser result: title: Antiques Road Trip, season: 18, episode: [10], video_codec: Xvid, release_group: AFG, type: episode, parsing_time: 0.13213849067687988, absolute_episode: [], quality: Unknown, total_time: 0.14036178588867188
2019-05-26 11:01:27 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Antiques.Road.Trip.S18E10.720p.HDTV.x264-DOCERE to a series in your database. Parser result: title: Antiques Road Trip, season: 18, episode: [10], screen_size: 720p, source: HDTV, video_codec: H.264, video_encoder: x264, release_group: DOCERE, type: episode, parsing_time: 0.1811690330505371, absolute_episode: [], quality: 720p HDTV, total_time: 0.1888871192932129
2019-05-26 11:01:27 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Dancing.With.The.Stars.NZ.S08E11.480p.x264-mSD to a series in your database. Parser result: title: Dancing With The Stars NZ, season: 8, episode: [11], screen_size: 480p, video_codec: H.264, video_encoder: x264, release_group: mSD, type: episode, parsing_time: 0.1793828010559082, absolute_episode: [], quality: SDTV, total_time: 0.18767857551574707
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Jungle.Gold.S01E05.1080p.HEVC.x265-MeGusta to a series in your database. Parser result: title: Jungle Gold, season: 1, episode: [5], screen_size: 1080p, video_codec: H.265, video_profile: High Efficiency Video Coding, video_encoder: x265, release_group: MeGusta, type: episode, parsing_time: 0.19335484504699707, absolute_episode: [], quality: 1080p HDTV, total_time: 0.20157599449157715
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Unable to match Close.Calls.On.Camera.S06E05.720p.HEVC.x265-MeGusta to a series in your database. Parser result: title: Close Calls On Camera, season: 6, episode: [5], screen_size: 720p, video_codec: H.265, video_profile: High Efficiency Video Coding, video_encoder: x265, release_group: MeGusta, type: episode, parsing_time: 0.1879885196685791, absolute_episode: [], quality: 720p HDTV, total_time: 0.19620394706726074
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [Speedcd] :: [429bbf9] Hit old cached items, not parsing any more for: speedcd
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] Updating providers cache
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] Search mode: RSS
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] GET URL: **********api?t=search&limit=100&offset=0&cat=5000%2C5080%2C5020%2C5040%2C5200%2C5050%2C5030%2C5060%2C5045&maxage=3331&apikey=********** [Status: 404]
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] User-Agent: Medusa/0.3.1 (Linux; 4.9.35-v7+; 3ee79d80-7b55-11e9-aa0d-b827eb6b4d4c)
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] The response returned a non-200 response while requesting url **********api Error: HTTPError('404 Client Error: Not Found for url: **********api?t=search&limit=100&offset=0&cat=5000%2C5080%2C5020%2C5040%2C5200%2C5050%2C5030%2C5060%2C5045&maxage=3331&apikey=**********')
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] No data returned from provider
2019-05-26 11:01:28 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] Search mode: RSS
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] GET URL: **********api?t=search&limit=100&offset=0&cat=5000%2C5080%2C5020%2C5040%2C5200%2C5050%2C5030%2C5060%2C5045&maxage=3331&apikey=********** [Status: 404]
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] User-Agent: Medusa/0.3.1 (Linux; 4.9.35-v7+; 3ee79d80-7b55-11e9-aa0d-b827eb6b4d4c)
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] The response returned a non-200 response while requesting url **********api Error: HTTPError('404 Client Error: Not Found for url: **********api?t=search&limit=100&offset=0&cat=5000%2C5080%2C5020%2C5040%2C5200%2C5050%2C5030%2C5060%2C5045&maxage=3331&apikey=**********')
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] No data returned from provider
2019-05-26 11:01:29 INFO     SEARCHQUEUE-DAILY-SEARCH :: [6Box] :: [429bbf9] Removing cache entries older than 15 days from 6box
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [BTDB] :: [429bbf9] Updating providers cache
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [BTDB] :: [429bbf9] Search mode: RSS
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [BTDB] :: [429bbf9] GET URL: https://btdb.eu/recent?category=show [Status: 200]
2019-05-26 11:01:29 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [BTDB] :: [429bbf9] User-Agent: Medusa/0.3.1 (Linux; 4.9.35-v7+; 3ee79d80-7b55-11e9-aa0d-b827eb6b4d4c)
2019-05-26 11:01:29 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [BTDB] :: [429bbf9] DailySearchQueueItem Exception, error: 'NoneType' object has no attribute 'find_all'
Traceback (most recent call last):
  File "/home/pi/Medusa/medusa/search/queue.py", line 263, in run
    found_results = search_for_needed_episodes(self.scheduler_start_time, force=self.force)
  File "/home/pi/Medusa/medusa/search/core.py", line 524, in search_for_needed_episodes
    cur_provider.cache.update_cache(scheduler_start_time)
  File "/home/pi/Medusa/medusa/tv/cache.py", line 207, in update_cache
    data = self._get_rss_data()
  File "/home/pi/Medusa/medusa/tv/cache.py", line 190, in _get_rss_data
    return {'entries': self.provider.search(self.search_params)}
  File "/home/pi/Medusa/medusa/providers/torrent/html/btdb.py", line 78, in search
    results += self.parse(response.text, mode)
  File "/home/pi/Medusa/medusa/providers/torrent/html/btdb.py", line 99, in parse
    torrent_rows = table_body.find_all('li', class_='recent-item')
AttributeError: 'NoneType' object has no attribute 'find_all'

# 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", id="torrenttable")
        torrent_rows = torrent_table.find_all("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

        # Scenetime apparently uses different number of cells in #torrenttable based
        # on who you are. This works around that by extracting labels from the first
        # <tr> and using their index to find the correct download/seeders/leechers td.
        labels = [
            label.get_text(strip=True) or label.img["title"]
            for label in torrent_rows[0]("td")
        ]

        # Skip column headers
        for row in torrent_rows[1:]:
            cells = row("td")
            if len(cells) < len(labels):
                continue

            try:
                link = cells[labels.index("Name")]
                torrent_id = (
                    link.find("a")["href"].replace("details.php?id=", "").split("&")[0]
                )
                title = link.find("a").get_text(strip=True)
                download_url = self.urls["download"].format(
                    torrent_id, "{0}.torrent".format(title.replace(" ", "."))
                )
                if not all([title, download_url]):
                    continue

                seeders = try_int(cells[labels.index("Seeders")].get_text(strip=True))
                leechers = try_int(cells[labels.index("Leechers")].get_text(strip=True))

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

                torrent_size = cells[labels.index("Size")].get_text()
                torrent_size = re.sub(r"(\d+\.?\d*)", r"\1 ", torrent_size)
                size = convert_size(torrent_size) or -1

                # Get the last item from the "span" list to avoid parsing "NEW!" as a pub date.
                pubdate_raw = link.find_all("span")[-1]["title"]
                pubdate = self.parse_pubdate(pubdate_raw)

                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.exception("Failed parsing provider.")

    return items