2007-03-01 15:11:35 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2007-03-06 22:07:25 +00:00
|
|
|
# -*- Mode: Python; -*-
|
2007-03-01 15:11:35 +00:00
|
|
|
# vi:si:et:sw=2:sts=2:ts=2
|
|
|
|
|
|
|
|
from urllib import quote
|
|
|
|
import re
|
|
|
|
|
|
|
|
from BeautifulSoup import BeautifulSoup
|
|
|
|
|
|
|
|
from utils import read_url, stripTags
|
|
|
|
from btutils import torrentsWeLike
|
|
|
|
|
|
|
|
|
|
|
|
def search(query):
|
|
|
|
'''search for torrents on btjunkie
|
|
|
|
'''
|
|
|
|
url = "http://btjunkie.org/search?q=%s&c=6&t=0&o=52&m=0&l=1" % quote(query)
|
|
|
|
page = read_url(url)
|
|
|
|
soup = BeautifulSoup(page)
|
|
|
|
torrents = soup.findAll('a', {'class': 'BlckUnd'})
|
|
|
|
torrents = filter(torrentsWeLike, torrents)
|
|
|
|
torrent_links = []
|
|
|
|
for t in torrents:
|
|
|
|
tlink = "http://btjunkie.org%s.torrent" % t.attrMap['href']
|
|
|
|
tlink = tlink.replace('do=stat', 'do=download')
|
|
|
|
torrent_links.append(tlink)
|
|
|
|
return torrent_links
|
|
|
|
|
|
|
|
def searchByImdb(imdb):
|
|
|
|
'''search for torrents by imdb, not supported on btjunkie right now
|
|
|
|
'''
|
|
|
|
return []
|