代码怎么转换成磁力链接(怎么把文件转成磁力链)

百度云管家如何使用磁力链接(神秘代码)

工具/材料

电脑 百度云管家

01

首先我们打开百度云管家,点击 离线下载

02

然后就会弹出新建下载框

03

我们在新建下载框里面粘贴好我们的磁力链接(神秘代码)后,点击下载

04

然后很快就会显示下载完成(秒下)

05

现在我们回到百度云管家桌面就可以看到磁力链接已经生成电影了,双击电影就可以在线观看了

手机磁力链有复制代码怎么用

1、首先在应用商店下载迅雷APP。

2、然后在迅雷APP中完成登录注册,在右上方找到磁力链接收文本框。

3、将磁力链的复制代码转移到文本框中,迅雷就会自动读取并下载磁力链中的视频。

如何使用python实现bt种子和磁力链接的相互转换

相应的将BT种子转换为磁力链代码为:

import bencode, hashlib, base64, urllib

torrent = open(\’ubuntu-12.04.2-server-amd64.iso.torrent\’, \’rb\’).read()

metadata = bencode.bdecode(torrent)

hashcontents = bencode.bencode(metadata[\’info\’])

digest = hashlib.sha1(hashcontents).digest()

b32hash = base64.b32encode(digest)

params = {\’xt\’: \’urn:btih:%s\’ % b32hash,

\’dn\’: metadata[\’info\’][\’name\’],

\’tr\’: metadata[\’announce\’],

\’xl\’: metadata[\’info\’][\’length\’]}

paramstr = urllib.urlencode(params)

magneturi = \’magnet:?%s\’ % paramstr

print magneturi

还有另外一个效率相对较高,而且更方便的方案是安装libtorrent,在ubuntu只需要apt-get install python-libtorrent即可对应转换磁力链的代码为:

import libtorrent as bt

info = bt.torrent_info(\’test.torrent\’)

print \”magnet:?xt=urn:btih:%sdn=%s\” % (info.info_hash(), info.name())

转换磁力链接为bt种子文件

下面来看一个反过程,将磁力链转化为种子文件。

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 sys

import libtorrent as lt

from time import sleep

def magnet2torrent(magnet, output_name=None):

if output_name and \\

not pt.isdir(output_name) and \\

not pt.isdir(pt.dirname(pt.abspath(output_name))):

print(\”Invalid output folder: \” + pt.dirname(pt.abspath(output_name)))

print(\”\”)

sys.exit(0)

tempdir = tempfile.mkdtemp()

ses = lt.session()

params = {

\’save_path\’: tempdir,

\’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)\”)

while (not handle.has_metadata()):

try:

sleep(1)

except KeyboardInterrupt:

print(\”Aborting…\”)

ses.pause()

print(\”Cleanup dir \” + tempdir)

shutil.rmtree(tempdir)

sys.exit(0)

ses.pause()

print(\”Done\”)

torinfo = handle.get_torrent_info()

torfile = lt.create_torrent(torinfo)

output = pt.abspath(torinfo.name() + \”.torrent\”)

if output_name:

if pt.isdir(output_name):

output = pt.abspath(pt.join(

output_name, torinfo.name() + \”.torrent\”))

elif pt.isdir(pt.dirname(pt.abspath(output_name))):

output = pt.abspath(output_name)

print(\”Saving torrent file here : \” + output + \” …\”)

torcontent = lt.bencode(torfile.generate())

f = open(output, \”wb\”)

f.write(lt.bencode(torfile.generate()))

f.close()

print(\”Saved! Cleaning up dir: \” + tempdir)

ses.remove_torrent(handle)

shutil.rmtree(tempdir)

return output

def showHelp():

print(\”\”)

print(\”USAGE: \” + pt.basename(sys.argv[0]) + \” MAGNET [OUTPUT]\”)

print(\” MAGNET\\t- the magnet url\”)

print(\” OUTPUT\\t- the output torrent file name\”)

print(\”\”)

def main():

if len(sys.argv) 2:

showHelp()

sys.exit(0)

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 magnet link [torrent file]

怎么把文件转换成磁力链接

需要把文件传到迅雷里,然后下载,在电脑端右键下载的文件就能生成磁力链接了,很麻烦,如果不是必要,不建议这么做,希望可以采纳

怎么把浏览器视频链接转换成磁力链接

方法/步骤

1.进入btdigg网站,随便搜一个词,比如“中医古籍”

2.好了我们开始找我们想要的内容,点击磁力链接,如果你的迅雷插件正常的话,就弹出对话框,分析链接中。

3.如果无法弹出,也可以点击右键,复制链接,进入迅雷新建任务,粘贴就好了,或者用迅雷上的修复试一下。

分析链接好了后,会进入下载对话框后,下面有立即下载,的点击它右侧的下拉三角,选择手动下载。

点确定,会进入下载界面,好了右击任务,点击生成种子,一个我们需要的种子就生成了。

0

评论0