def use_node_by_policy(url, vod_nodes, gdriveid, policy):
	nodes = parse_vod_nodes(vod_nodes)
	assert nodes
	logger = lixian_logging.get_logger()
	logger.debug('Download URL: ' + url)
	try:
		node_url = resolve_node_url(url, gdriveid, timeout=60)
		logger.debug('Resolved URL: ' + node_url)
	except:
		import traceback
		logger.debug(traceback.format_exc())
		return url
	default_node = re.match(r'http://(vod\d+)\.', node_url).group(1)
	if default_node not in nodes:
		nodes.insert(0, default_node)
	chosen = policy(node_url, nodes, gdriveid)
	if chosen:
		logger.debug('Switch to URL: ' + chosen)
		return chosen
	else:
		return node_url
dataset/ETHPy150Open iambus/xunlei-lixian/lixian_nodes.py/use_node_by_policy/original