2
def magnet2torrent(id, info_hash): info_hash_id=id magnet="magnet:?xt=urn:btih:"+info_hash ses = lt.session() params = { 'save_path': './', 'duplicate_is_error': True, 'storage_mode': lt.storage_mode_t(2), 'paused': False, 'auto_managed': True, 'duplicate_is_error': True } handle = lt.add_magnet_uri(ses, magnet, params) print("Downloading Metadata (this may take a while)") i = 0; while (not handle.has_metadata()): # i = i+1 if i > 300 : return sleep(1) ses.pause() print("Done") torinfo = handle.get_torrent_info() con = db.get_conncetion() cur = con.cursor() for f in torinfo: cur.execute("INSERT INTO file_list (info_hash_id, name, size) VALUES (\""+str(info_hash_id)+"\", \""+str(f.path)+"\", "+str(f.size)+");") print("INSERT INTO file_list (info_hash_id, name, size) VALUES (\""+str(info_hash_id)+"\", \""+str(f.path)+"\", "+str(f.size)+");") con.commit() cur.close() con.close()
내가 토런트 파일에서 info_hash에서 토런트 파일을 가져올 수 있다면 토런트 파일에서 파일 목록을 가져올 수 있다고 생각합니다.python libtorrent info_hash에서 토런트 파일 목록을 얻는 방법은 무엇입니까?
그러나 내 코드를 실행할 때
while (not handle.has_metadata()):끝나지 않았습니다. 하지만 웹 페이지는 http://magnet2torrent.com입니다. 즉시 급류를 내게됩니다.
info_hash에서 파일 목록을 가져 오는 방법은 무엇입니까?
다른 피어를 전혀 찾으십니까? 결국 DHT 라우팅 테이블에 노드가 생기게됩니까? – Arvid