question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get torrent object on adding torrent

See original GitHub issue

Is it possible that you can make it so that when torrents_add is called it returns torrent object? Supposedly I have a torrent magnet url and no other info about it, and the hash is tagged-info-hash which is not info-hash,

Example magnet link: magnet:?xt=urn:btih:GQMKCY7EZSUS3PDQY7FL23X2AM763ESE&tr=udp://tracker.coppersurfer.tk:6969/announce I thought assuming and using GQMKCY7EZSUS3PDQY7FL23X2AM763ESE as info hash was enough, but after I added the magnet url the info hash came out as 3418a163e4cca92dbc70c7cabd6efa033fed9244 and then I learnt that there are 2 types of hashes from here: https://stackoverflow.com/questions/61640538/obtaining-metadata-from-magnetlink-infohash

In this scenario after adding the torrent I don’t know how to get the torrent object, because torrents_add returns Ok. and the torrent is then lost (No way to find which is the added torrent)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
modbendercommented, Sep 29, 2020

I went to python discord and asked the question surprisingly I got the right answer: Here is what I’m using to get info hash from magnet url.

def get_magnet_hash(magnet_url):
    extract = magnet_url[magnet_url.find("btih:") + 5:magnet_url.find("&")]
    if len(extract) != 40:
        return base64.b16encode(base64.b32decode(extract)).lower().decode('utf8')
    return extract
0reactions
rmartin16commented, Sep 29, 2020

nice. i was poking around but the hashing algorithm wasn’t entirely obvious…it does look like magnet links can be quite varied and support all kinds of specifications…as long as they’re just btih magnets…i’d expect that to work great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GetObjectTorrent - Amazon Simple Storage Service
Returns torrent files from a bucket. BitTorrent can save you bandwidth when you're distributing large files. ... You can get torrent only for...
Read more >
How to distribute AWS S3 objects using BitTorrent
Steps to distribute AWS S3 objects using BitTorrent: · Create an S3 bucket. · Go to S3 dashboard of your AWS Management Console....
Read more >
Add torrent with label by magnetic link using UTorrentAPI
I have a magnetic link to a torrent. So I add the torrent to uTorrent using AddUrl method: using(var client = new UTorrentClient(apiurl, ......
Read more >
How to Create and Seed a Torrent Download on Amazon S3
Now you want to create the torrent file itself. Just enter the following URL: http://s3.amazonaws.com/your_bucket_name/your_file_name?torrent and the torrent ...
Read more >
get-object-torrent — AWS CLI 2.9.0 Command Reference
You can get torrent only for objects that are less than 5 GB in size, and that are not encrypted using server-side encryption...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found