本文整理汇总了Python中asi.Utils.setTorExitNodes方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.setTorExitNodes方法的具体用法?Python Utils.setTorExitNodes怎么用?Python Utils.setTorExitNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asi.Utils
的用法示例。
在下文中一共展示了Utils.setTorExitNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from asi import Utils [as 别名]
# 或者: from asi.Utils import setTorExitNodes [as 别名]
def process(args):
db = {}
proxy = None
if args.location:
Config.programFolder = Config.createFolder(args.location)
if args.tor:
# we use privoxy to access tor
Utils.setTorExitNodes(args.tor, args.tor_pass)
proxy = { "http" : "http://127.0.0.1:8118",
"https" : "http://127.0.0.1:8118" }
else:
if args.proxy:
proxy = { "http" : args.proxy,
"https" : args.proxy }
proxyHandler = urllib.request.ProxyHandler(proxy)
grabber = urllib.request.build_opener(proxyHandler)
# we still need to install the global one, as sometimes we cannot pass in a new one
# (m3u8 and urlretrieve)
urllib.request.install_opener(grabber)
grabberForDownload = None
if args.tor and args.tor_only_metadata:
# we do not want to use to for the actual download
# only for the metadata
grabberForDownload = urllib.request.build_opener()
else:
# use the same opener everywhere
grabberForDownload = grabber
if args.ip:
width = Console.terminal_width()
Info.display(grabber, width, args.tor)
return
if args.page:
Page.download(db, grabber, args.page, args.download)
if args.ondemand:
Demand.download(db, grabber, args.download)
if args.tg:
TG.download(db, grabber, args.download)
if args.junior:
Junior.download(db, grabber, args.download)
if args.search:
Search.download(db, grabber, args.search, args.download)
if args.follow:
follows = args.follow
while follows:
subset = {}
find(db, follows[0], args.re, subset)
# continue follow calculation
db = {}
for p in subset.values():
p.follow(db, args.download)
follows = follows[1:] # continue with one element less
if args.replay:
Replay.download(db, grabber, args.download)
if args.pluzz:
Pluzz.download(db, grabber, args.download)
if args.tf1:
TF1.download(db, grabber, args.download)
if args.m6:
M6.download(db, grabber, args.download)
if args.mediaset:
Mediaset.download(db, grabber, args.download, "mediaset")
if args.tg5:
Mediaset.download(db, grabber, args.download, "tg5")
if args.item:
p = Item.Demand(grabber, args.item, args.download, len(db))
db[p.pid] = p
if args.m3u8:
p = Playlist.process(grabber, args.m3u8, len(db))
db[p.pid] = p
if args.pid:
subset = {}
for pid in args.pid:
find(db, pid, args.re, subset)
else:
subset = db
if args.date:
subset = filterByDate(subset, args.date)
#.........这里部分代码省略.........