Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is wrong with this ? #1278

Closed
NicholasKuchiniski opened this issue Jan 29, 2018 · 2 comments
Closed

what is wrong with this ? #1278

NicholasKuchiniski opened this issue Jan 29, 2018 · 2 comments

Comments

@NicholasKuchiniski
Copy link

@NicholasKuchiniski NicholasKuchiniski commented Jan 29, 2018

What version of WebTorrent?
Latest
What operating system and Node.js version?
Debian 9, v.9.4.0
What browser and version? (if using WebTorrent in the browser)
Chrome
What did you expect to happen?
Download the torrent
What actually happened?
i cant get the torrent and start the download

I've been trying to make this code work for a long time, it only works with some specific torrents such as the sintel.torrent file (https://webtorrent.io/torrents/sintel.torrent) that is shown on the site. However, if I try to add any torrent, be it from anidex or nya.sii (this which are the sites I use to provide torrents for my application), or even thepiratebay, those that work are rare, I do not know if it's are a problem with my internet or with my code, I come here to ask if this error is in the webtorrent or has something wrong with my code or with the torrents that I'm catching? (magnet / .torrent)

// Download function
download: (torrentId, callback) => {
//Webtorrent
       var client = new WebTorrent({ dht: false, tracker: false })
       //add torrent
       client.add(torrentId, function (torrent) {
           torrent.files.forEach(function (file) {
               file.getBlobURL(function (err, url) {
                //console .log final url
                  console.log(url)
               });
           });

           function onProgress() {
//Remaining time
              var remaining = moment.duration(torrent.timeRemaining / 1000, 'seconds').humanize()
               remaining = remaining[0].toUpperCase() + remaining.substring(1)
               //Callback to my react component
               callback(torrent.name, torrent.numPeers, Math.round(torrent.progress * 100 * 100) / 100, prettyBytes(torrent.downloaded), prettyBytes(torrent.length), remaining, prettyBytes(torrent.downloadSpeed) + '/s')
           }
           
        
           function onDone(){
               console.log("OK")
           }
           torrent.on('done', onDone);
       

           setInterval(onProgress, 200);
           onProgress();
       })
   }



@basst85

This comment has been minimized.

Copy link

@basst85 basst85 commented Jan 29, 2018

@NicholasKuchiniski

This comment has been minimized.

Copy link
Author

@NicholasKuchiniski NicholasKuchiniski commented Jan 29, 2018

thanks

@lock lock bot locked as resolved and limited conversation to collaborators May 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.