Пример #1
0
def link_normalize(url):
    from lixian_url import url_unmask, normalize_unicode_link
    url = url_unmask(url)
    if url.startswith('magnet:'):
        return 'bt://' + lixian_hash_bt.magnet_to_infohash(url).encode('hex')
    elif url.startswith('ed2k://'):
        return lixian_hash_ed2k.parse_ed2k_id(url)
    elif url.startswith('bt://'):
        return url.lower()
    elif url.startswith('http://') or url.startswith('ftp://'):
        return normalize_unicode_link(url)
    return url
Пример #2
0
def link_normalize(url):
	from lixian_url import url_unmask, normalize_unicode_link
	url = url_unmask(url)
	if url.startswith('magnet:'):
		return 'bt://'+lixian_hash_bt.magnet_to_infohash(url).encode('hex')
	elif url.startswith('ed2k://'):
		return lixian_hash_ed2k.parse_ed2k_id(url)
	elif url.startswith('bt://'):
		return url.lower()
	elif url.startswith('http://') or url.startswith('ftp://'):
		return normalize_unicode_link(url)
	return url