磁力链bt种子 磁力链bt种子合集
怎么制作种子文件及磁力链接?
shutil.rmtree(tempdir)可以使用Folx 5来快速制作种子文件及磁力链接。
磁力链bt种子 磁力链bt种子合集
磁力链bt种子 磁力链bt种子合集
not pt.isdir(pt.dirname(pt.abspath(output_name))):
一、制作种子文件
步,打开Folx软件,在上方的菜单中,选择“文件”菜单,然后点击其中的“创建种子文件”。
第二步,在打开的创建种子文件界面上,点击右侧的三个点按钮,选择位于Mac上的应用或者文件,然后点击“好”,即可为该应用或文件制作对应的种子文件。
从界面红框可知,大家可以自定义创建的种子的文件名、文件保存路径、文件块大小和文件的选项设置。
在文件名输很高兴回答楼主的问题入框中输入文件名,即可为种子定义一个种子文件名,否则种子文件名将默认按照文件的名称来命名;
然后在“保存至”选项中,设置种子的保存路径,免得制作完成以后找不到种子文件;
然后就是块大小,这里采用默认设置即可;
还有一个选项设置,可以设置是否立即开始制作种子以及种子是否是私人可用的。
制作完成以后,种子文件如下图所示,文件格式为“torrent”。
二、获取磁力链接
首先在Folx右侧的标签栏中,点击“我的上传”标签,从中找到刚刚制作的种子文件,然后鼠标右键点击该种子文件,在打开的菜单中,选择“磁力链接”,如下图所示,即可得到该种子的磁力链接了。
如何把bt种子转换磁力链接
pasys.exit(0)rams = {很简单,先用bitcomet打开这个种子新建一个任务,然后右键点击这个任务选Magnet
URI便print("")把磁力连接到剪贴版上了
如有错误请见谅
如何使用python实现bt种子和磁力链接的相互转换
import sys相应的将BT种子转换为磁力链代码为:
import bencode, hashlib, base64, lib
torrent = open('ubuntu-12.04.2-server-amd64.iso.torrent', 'rb').read()
metadata = bencode.bdecode(torrent)
hashcontents = bencode.bencode(metadata[''])
digest = hashlib.sha1(hashcontents).digest()
b32hash = base64.b32encode(digest)
params = {'xt': 'urn:btih:%s' % b32hash,
'dn': metadata['']['name'],
'tr': metadata['announce'],
'xl': metadata['']['length']}
paramstr = lib.encode(params)
magneturi = 'magnet:?%s' % paramstr
print magneturi
还有另外一个效率相对较高,而且更方便的方案是安装libtorrent,在ubuntu只需要apt-get install python-libtorrent即可对应转换磁力链的代码为:
import libtorrent as bt
= bt.torrent_('test.torrent')
print "magnet:?xt=urn:btih:%s&dn=%s" % (._hash(), .name())
转换磁力链接为bt种if len(sys.argv) < 2:子文件
下面来看一个反过程,将磁力链转化为种子文件。
1、需要先安装python-libtorrent包 ,在ubuntu环境下,可以通过以下指令完成安装:
# sudo apt-get install python-libtorrent
2、代码如下:
#!/usr/bin/env python
import shutil
import tempfile
import os.path as pt
import libtorrent as lt
from time import sleep
def magnet2torrent(magnet, output_name=None):
if output_name and ses.pause()
not pt.isdir(output_name) and
print("Invalid output folder: " + pt.dirname(pt.abspath(output_name)))
tempdir = tempfile.mkdtemp()
ses = lt.session()
'se_path': tempdir,
'duplicate_is_error': True,
'storage_mode': lt.storage_mode_t(2),
'paused': False,
'auto_mad': True,
'duplicate_is_error': True
}handle = lt.add_magnet_uri(ses, magnet, params)
print("Downloading Metadata (this may take a while)")
while (not handle.has_metadata()):
try:
sleep(1)
except KeyboardInterrupt:
print("Aborting...")
print("Cleanup dir " + tempdir)
print("Done")
tor = handle.get_torrent_()
torfile = lt.create_torrent(tor)
output = pt.abspath(tor.name() + ".torrent")
if output_name:
if pt.isdir(output_name):
output = pt.abspath(pt.join(
output_name, tor.name() + ".torrent"))
elif pt.isdir(pt.dirname(pt.abspath(output_name))):
output = pt.abspath(output_name)
print("Sing torrent file here : " + output + " ...")
torcontent = lt.bencode(torfile.generate())
f = open(output, "wb")
f.write(lt.bencode(torfile.generate()))
f.close()
print("Sed! Cleaning up dir: " + tempdir)
ses.remove_torrent(handle)
return output
def showHelp():
print("USAGE: " + pt.basename(sys.argv[0]) + " MAGNET [OUTPUT]")
print(" MAGNETt- the magnet ")
print(" OUTPUTt- the output torrent file name")
def main():
showHelp()
magnet = sys.argv[1]
output_name = None
if len(sys.argv) >= 3:
output_name = sys.argv[2]
magnet2torrent(magnet, output_name)
if __name__ == "__main__":
main()
3、用法如下
# python Magnet_To_Torrent2.py
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系 836084111@qq.com 删除。