'Uses the newznab provider url and apikey to get the capabilities.
Makes use of the default newznab caps param. e.a. http://yournewznab/api?t=caps&apikey=skdfiw7823sdkdsfjsfk
Returns a tuple with (succes or not, array with dicts [{\'id\': \'5070\', \'name\': \'Anime\'},
{\'id\': \'5080\', \'name\': \'Documentary\'}, {\'id\': \'5020\', \'name\': \'Foreign\'}...etc}], error message)'

def get_newznab_categories(self, just_caps=False):

    return_categories = []
    if (not self._check_auth()):
        return (False, return_categories, u'Provider    requires    auth    and    your    key    is    not    set')
    url_params = {u't': u'caps'}
    if (self.needs_auth and self.key):
        url_params[u'apikey'] = self.key
    data = self.get_url(urljoin(self.url, u'api'), params=url_params, returns=u'text')
    if (not data):
        error_string = u'Error    getting    caps    xml    for    [{0}]'.format(self.name)
        logger.log(error_string, logger.WARNING)
        return (False, return_categories, error_string)
    with BS4Parser(data, u'html5lib') as html:
        if (not html.find(u'categories')):
            error_string = u'Error    parsing    caps    xml    for    [{0}]'.format(self.name)
            logger.log(error_string, logger.DEBUG)
            return (False, return_categories, error_string)
        self.caps = html.find(u'searching')
        if just_caps:
            return (True, return_categories, u'Just    checking    caps!')
        for category in html(u'category'):
            if ((u'TV' in category.get(u'name', u'')) and category.get(u'id', u'')):
                return_categories.append({u'id': category[u'id'], u'name': category[u'name']})
                for subcat in category(u'subcat'):
                    if (subcat.get(u'name', u'') and subcat.get(u'id', u'')):
                        return_categories.append({u'id': subcat[u'id'], u'name': subcat[u'name']})
        return (True, return_categories, u'')
