def feed(idx): url = _FEEDLIST[idx]['url'] if url.endswith('.json'): return chanutils.reddit.get_feed(_FEEDLIST[idx]) else: r = get(url) return _extract(r.text)
def torrent_from_hash(hashid): path = "/torrent/" + hashid + ".torrent" for site in torr_sites: try: r = chanutils.get("http://" + site + path) return r.content except Exception: pass return None
def torrent_files(link): if link.startswith("magnet:"): torrent = magnet2torrent(link) else: # Remove any parameters from torrent link # as some sites may not download if wrong idx = link.find('?') if idx > -1: link = link[:idx] r = chanutils.get(link) torrent = r.content files = None if torrent: try: parser = TorrentParser(torrent) files = parser.get_files_details() except Exception, e: pass
def search(q): r = get(_SEARCH_URL, params={'q':q}) return _extract(r.text)