'Freshon.tv search plugin
Config example:
tv_search_freshon:
discover:
what:
- trakt_list:
username: xxxxxxx
password: xxxxxxx
list: somelist
type: shows
from:
- freshon:
username: xxxxxx
password: xxxxxx
passkey: xxxxx
interval: 1 day
ignore_estimations: yes
Category is one of:
all
hd
webdl
Freeleech is one of:
all
free
half'

@plugin.internet(log)
def search(self, task, entry, config):

    self.config = config
    if (not task.requests.cookies):
        self.login(task)
    freeleech = LEECHSTATUS[config[u'freeleech']]
    entries = set()
    for search_string in entry.get(u'search_strings', [entry[u'title']]):
        query = normalize_scene(search_string)
        params = {u'search': query, u'tab': config[u'category'], u'incldead': freeleech, u'page': None}
        url = (u'%s/%s' % (BASE_URL, SEARCH_PAGE))
        log.debug(u'Search    :    %s    %s', url, params)
        try:
            page = task.requests.get(url, params=params).content
        except RequestsException:
            log.error(u'Could    not    get    page    %s,    %s,    skipping', url, params)
            continue
        soup = get_soup(page)
        if soup.findAll(text=re.compile(u'Nothing    found.    Try    again    with    a    refined    search    string.')):
            log.debug(u'Search    returned    no    results')
        else:
            page_number = self.get_page_number(soup)
            nextpage = 0
            while (nextpage < page_number):
                if (nextpage > 0):
                    params[u'page'] = nextpage
                    log.debug(u'----->    NEXT    PAGE    :    %s    %s', url, params)
                    try:
                        f1 = task.requests.get(url, params=params).content
                    except RequestsException:
                        log.error(u'Could    not    get    page    %s,    %s,    skipping', url, params)
                        continue
                    soup = get_soup(f1)
                results = soup.findAll(u'tr', {u'class': re.compile(u'torrent_[0-9]*')})
                for res in results:
                    entry = self.parse_entry(res)
                    if entry:
                        entries.add(entry)
                nextpage += 1
    return entries
