# Buggy code
def __init__(self):
    TorrentProvider.__init__(self, "Rarbg")

    self.public = True
    self.minseed = None
    self.ranked = None
    self.sorting = None
    self.minleech = None
    self.token = None
    self.token_expires = None

    # Spec: https://torrentapi.org/apidocs_v2.txt
    self.url = "https://rarbg.com"
    self.urls = {"api": "http://torrentapi.org/pubapi_v2.php"}

    self.proper_strings = ["{{PROPER|REPACK}}"]

    self.cache = tvcache.TVCache(
        self, min_time=10
    )  # only poll RARBG every 10 minutes max


# Traceback (AttributeError)
2020-01-12 09:11:36 ERROR    SHOWQUEUE-ADD :: [b6fe632] Unable to look up the show in None on theTVDB using ID 360733, not using the NFO. Delete .nfo and try adding manually again.: 'Series' object has no attribute 'title'
2020-01-12 09:11:36 INFO     SHOWQUEUE-ADD :: Starting to add show by Indexer Id: 360733
2020-01-12 09:11:35 DEBUG    SEARCHQUEUE-BACKLOG-258541 :: [NZB.Cat] :: Search string: Chicago Fire S05E11
2020-01-12 09:11:35 DEBUG    SEARCHQUEUE-BACKLOG-258541 :: [NZB.Cat] :: Search Mode: Episode
2020-01-12 09:11:34 INFO     SEARCHQUEUE-BACKLOG-258541 :: [NZB.Cat] :: Request failed: 429 Client Error: Too Many Requests for url: https://nzb.cat/api?apikey=**********&tvdbid=258541&season=5&maxage=999&cat=5030%2C5040&limit=100&t=tvsearch&offset=0&ep=10 (<type 'str'>)

AttributeError: 'ShowIndexer' object has no attribute 'series_poster_by_id'
    image_url = sickchill.indexer.series_poster_by_id(indexerId)
  File "C:\SickRage\SickRage\sickchill\views\manage\add_shows.py", line 345, in getTrendingShowImage
    result = function(**kwargs)
  File "C:\SickRage\SickRage\sickchill\views\index.py", line 182, in async_call
    result = self.fn(*self.args, **self.kwargs)
  File "C:\SickRage\SickRage\lib\concurrent\futures\thread.py", line 63, in run
    return self.__get_result()
  File "C:\SickRage\SickRage\lib\concurrent\futures\_base.py", line 455, in result
    value = future.result()
  File "C:\SickRage\SickRage\lib\tornado\gen.py", line 1055, in run
    results = yield self.async_call(method)
  File "C:\SickRage\SickRage\sickchill\views\index.py", line 160, in get
2020-01-12 09:11:34 DEBUG    TORNADO :: Failed doing webui request "getTrendingShowImage": Traceback (most recent call last):

AttributeError: 'ShowIndexer' object has no attribute 'series_poster_by_id'
    image_url = sickchill.indexer.series_poster_by_id(indexerId)
  File "C:\SickRage\SickRage\sickchill\views\manage\add_shows.py", line 345, in getTrendingShowImage
    result = function(**kwargs)
  File "C:\SickRage\SickRage\sickchill\views\index.py", line 182, in async_call
    result = self.fn(*self.args, **self.kwargs)
  File "C:\SickRage\SickRage\lib\concurrent\futures\thread.py", line 63, in run
    return self.__get_result()
  File "C:\SickRage\SickRage\lib\concurrent\futures\_base.py", line 455, in result
    value = future.result()
  File "C:\SickRage\SickRage\lib\tornado\gen.py", line 1055, in run
    results = yield self.async_call(method)
  File "C:\SickRage\SickRage\sickchill\views\index.py", line 160, in get
2020-01-12 09:11:33 DEBUG    TORNADO :: Failed doing webui request "getTrendingShowImage": Traceback (most recent call last):

AttributeError: 'ShowIndexer' object has no attribute 'series_poster_by_id'
    image_url = sickchill.indexer.series_poster_by_id(indexerId)
  File "C:\SickRage\SickRage\sickchill\views\manage\add_shows.py", line 345, in getTrendingShowImage
    result = function(**kwargs)
  File "C:\SickRage\SickRage\sickchill\views\index.py", line 182, in async_call
    result = self.fn(*self.args, **self.kwargs)
  File "C:\SickRage\SickRage\lib\concurrent\futures\thread.py", line 63, in run
    return self.__get_result()
  File "C:\SickRage\SickRage\lib\concurrent\futures\_base.py", line 455, in result
    value = future.result()
  File "C:\SickRage\SickRage\lib\tornado\gen.py", line 1055, in run
    results = yield self.async_call(method)
  File "C:\SickRage\SickRage\sickchill\views\index.py", line 160, in get
2020-01-12 09:11:33 DEBUG    TORNADO :: Failed doing webui request "getTrendingShowImage": Traceback (most recent call last):


# Fixed code
def __init__(self):
    TorrentProvider.__init__(self, "Rarbg")

    self.public = True
    self.minseed = None
    self.ranked = None
    self.sorting = None
    self.minleech = None
    self.token = None
    self.token_expires = None

    # Spec: https://torrentapi.org/apidocs_v2.txt
    self.url = "https://rarbg.to"
    self.urls = {"api": "http://torrentapi.org/pubapi_v2.php"}

    self.proper_strings = ["{{PROPER|REPACK}}"]

    self.cache = tvcache.TVCache(
        self, min_time=10
    )  # only poll RARBG every 10 minutes max