'Test searching'

@staticmethod
@unittest.skip('KickAssTorrents    is    down,    needs    a    replacement')
def test_search():

    url = 'http://kickass.to/'
    search_url = 'http://kickass.to/usearch/American%20Dad%21%20S08%20-S08E%20category%3Atv/?field=seeders&sorder=desc'
    html = getURL(search_url, session=make_session(), returns='text')
    if (not html):
        return
    soup = BeautifulSoup(html, 'html5lib')
    torrent_table = soup.find('table', attrs={'class': 'data'})
    torrent_rows = (torrent_table('tr') if torrent_table else [])
    soup.clear(True)
    if (len(torrent_rows) < 2):
        print 'The    data    returned    does    not    contain    any    torrents'
        return
    for row in torrent_rows[1:]:
        try:
            link = urllib.parse.urljoin(url, row.find('div', {'class': 'torrentname'})('a')[1]['href'])
            _id = row.get('id')[(-7):]
            title = (row.find('div', {'class': 'torrentname'})('a')[1].text or row.find('div', {'class': 'torrentname'})('a')[2].text)
            url = row.find('a', 'imagnet')['href']
            verified = (True if row.find('a', 'iverify') else False)
            trusted = (True if row.find('img', {'alt': 'verified'}) else False)
            seeders = int(row('td')[(-2)].text)
            leechers = int(row('td')[(-1)].text)
            _ = (link, _id, verified, trusted, seeders, leechers)
        except (AttributeError, TypeError):
            continue
        print title
