<%include partials/header.ejs %>

<div class="container">
    <h1>Get list of trackers</h1>

    <label for="pid">Peer Id:</label>
    <input type="text" class="form-control" id="pid">

    <label for="mag_url">Provide a valid magnetic url:</label>
    <textarea id="mag_url" cols="30" rows="10" class="form-control"></textarea>

    <button type="submit" id="btn-tk" class="btn btn-primary">Hit</button>

    <div id="tl-res" style="padding: 5rem 5rem"></div>
</div>

<%include partials/footer.ejs %>

<script>
    $(document).on("click", "#btn-tk", function() {
        var mag_url = $("#mag_url").val();
        var job = "track list";
        var pid = $("#pid").val();

        $("#tl-res").text("Getting information from the server...it can take few minutes.");

        $.ajax({
            url:'/trackers-list',
            type:'post',
            data:{job:job, mag_url:mag_url, pid:pid},
            success: function(data) {
                console.log(data);
                if (data.length>0) {    
                    $("#tl-res").text(data);
                }
            }, 
            error: function(e) {
                console.error(e);
            }
        })
    })
</script>

<!-- Magnetic url: magnet:?xt=urn:btih:4a7b842632ca42cdd3c8d54017a8da756839b84d&dn=D0112-Chacha.Choudhary.Sabu.Kaale.Tapu.Mein.pdf&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com -->
<!-- 2d5757303030322d76726379554a35752b7a6248 -->