yggscr package

Submodules

yggscr.client.deluge_add_torrent(ip, port, user, password, torrent_binary)[source]
yggscr.client.exec_cmd(cmd)[source]
yggscr.client.rtorrent_add_torrent(rpc_url, torrent_binary=None, torrent_file=None)[source]
yggscr.client.transmission_add_torrent(ip, port, user, password, torrent_binary)[source]
yggscr.const.detect_redir()[source]
exception yggscr.exceptions.LoginFailed[source]

Bases: Exception

exception yggscr.exceptions.TooManyFailedLogins[source]

Bases: Exception

exception yggscr.exceptions.YggException[source]

Bases: Exception

yggscr.link.cat_subcat_from_href(href)[source]
yggscr.link.get_cat_id(cat, subcat=None, log=None)[source]
yggscr.link.list_cat_subcat()[source]
yggscr.link.list_cats()[source]
yggscr.link.list_subcats(cat)[source]
class yggscr.sbrowser.SBrowser(log, scraper=None, browser=None, proxy=None, **kwargs)[source]

Bases: object

General scrapper browser

connection_details()[source]

Return WAN connection detail

is_cloudflare()[source]
open(url, **kwargs)[source]
parsed()[source]
proxify(https_proxy=None)[source]
Sets an https-only proxy:
  • https://user:pass@host:port : HTTP proxy
  • socks5h://user:pass@host:port : SOCKS proxy
  • socks5://user:pass@host:port : SOCKS proxy with local DNS resolver
response()[source]
class yggscr.shell.YggShell(log=None, ygg_browser=None, **kwargs)[source]

Bases: cmd2.cmd2.Cmd

Ygg command line interface

do_debug(line)[source]

toggle debug

do_exclus(line)[source]

Get exclu

do_login(line)[source]

login <user> <pass> used to authenticate on ygg

do_logout(line)[source]
do_lscat(line)[source]

list categories and subcategories

do_next(line)[source]

returns next torrents from previous search or list

do_open(url)[source]

do a simple get on an url

do_ping(line)[source]

perform a connection to /

do_print(line)[source]

prints connection status

do_proxify(line)[source]

Sets or resets proxy settings proxify [xxx://user:pass@host:port] proxify without arguments will set no proxy proxify http://1.1.1.1:8080 to select an http proxy proxify socks5h://1.1.1.1 to select a socks proxy with remote dns proxify socks5://1.1.1.1 to select a socks proxy with local dns

do_response(line)[source]

get last response

do_search_torrents(line)[source]

search torrents search_torrents q:<pattern> [c:<category>] [s:<subcategory>] [s:<subcategory>] [opt1:val] [opt2:val1] [opt2:val2] [d:False] [n:3] any other option will be passed unchanged to the webserver d is for detail which will fetch each torrent url for more details n is the number of torrents to display (all by default)

do_stats(line)[source]

stats to return ratio statistics once authenticated

do_top_day(line)[source]

Get Top day

do_top_month(line)[source]

Get Top month

do_top_week(line)[source]

Get Top week

static kv_to_dict(line)[source]

Converts a:1 b:3 a:2 to {‘a’: [‘1’, ‘2’], ‘b’: ‘3’}

print_torrents(torrents, n=None)[source]
yggscr.shell.wrapper(method)[source]
class yggscr.shout.ShoutMessage(shout, soup=None, mtime=None, user=None, group=None, message=None)[source]

Bases: object

parse_shout(soup)[source]
class yggscr.shout.YggShout(log, robs=None, debug=False, irc=False, colour=False)[source]

Bases: object

do_diff()[source]

Compute and return list of new shouts

get_shouts()[source]

Set current shouts from website

yggscr.shout.main(argv=None)[source]
yggscr.shout.main_loop(log, NTRY=5)[source]
yggscr.shout.parse_file(hfile)[source]
class yggscr.stats.Stats[source]

Bases: object

add(vals)[source]
upd_speed()[source]
class yggscr.torrents.Torrent(torrent_title, torrent_comm, torrent_age, torrent_size, torrent_completed, torrent_seed, torrent_leech, href, log=None, thref=None, tid=None, cat=None, subcat=None, uploader=None)[source]

Bases: object

set_id(tid)[source]
set_tref(thref)[source]
yggscr.torrents.htn(hsize)[source]
class yggscr.ygg.YggBrowser(log=None, scraper=None, browser=None, proxy=None)[source]

Bases: yggscr.sbrowser.SBrowser

Ygg Scrapper

cat_subcat()[source]
download_torrent(torrent=None, torrent_id=None)[source]
exclus()[source]
gen_state()[source]
get_stats()[source]
login(ygg_id=None, ygg_pass=None)[source]
logout()[source]
next_torrents(nmax=100)[source]
ping()[source]
search_torrents(detail=False, q=None, nmax=100, **kwargs)[source]
top_day()[source]
top_month()[source]
top_week()[source]

Logger object - As logging, we only need and enforce a single instance

yggscr.ylogging.add_stdout_handler(logger)[source]

If no handlers already registered, add a stream formatted handler, level WARN

yggscr.ylogging.get_logger()[source]

Return yggscr logger

yggscr.ylogging.init_default_logger()[source]

Used in non OO calling to create logger and add a stream handler

yggscr.ylogging.loggerlevel_as_text(logger)[source]

Get debug level as text

yggscr.ylogging.set_log_debug(logger, debug=True)[source]

Update logger level WARN/DEBUG

Module contents

Yggtorrent scraper library - Webserver - Rss - Shell

Copyright:© 2018-2019, Laurent Kislaire.
License:ISC (see /LICENSE).