[GH-ISSUE #323] ws tracker list in js/jsonp format as well #279

Closed
opened 2026-02-26 05:33:39 +03:00 by kerem · 2 comments
Owner

Originally created by @bmacho on GitHub (Jul 15, 2021).
Original GitHub issue: https://github.com/ngosang/trackerslist/issues/323

the content of trackers_all_ws.txt could be in a format something like

trackers_all_ws( {list: [
  "wss://tracker.openwebtorrent.com",
  "wss://tracker.btorrent.xyz",
  "wss://tracker.files.fm:7073/announce",
  "wss://spacetradersapi-chatbox.herokuapp.com:443/announce"
]} )

or

trackers_all_ws = [
  "wss://tracker.openwebtorrent.com",
  "wss://tracker.btorrent.xyz",
  "wss://tracker.files.fm:7073/announce",
  "wss://spacetradersapi-chatbox.herokuapp.com:443/announce"
]

So one could call it with ajax/jsonp, or embed it as a script file, in a web page.

Originally created by @bmacho on GitHub (Jul 15, 2021). Original GitHub issue: https://github.com/ngosang/trackerslist/issues/323 the content of trackers_all_ws.txt could be in a format something like ``` trackers_all_ws( {list: [ "wss://tracker.openwebtorrent.com", "wss://tracker.btorrent.xyz", "wss://tracker.files.fm:7073/announce", "wss://spacetradersapi-chatbox.herokuapp.com:443/announce" ]} ) ``` or ``` trackers_all_ws = [ "wss://tracker.openwebtorrent.com", "wss://tracker.btorrent.xyz", "wss://tracker.files.fm:7073/announce", "wss://spacetradersapi-chatbox.herokuapp.com:443/announce" ] ``` So one could call it with ajax/jsonp, or embed it as a script file, in a web page.
kerem 2026-02-26 05:33:39 +03:00
Author
Owner

@ngosang commented on GitHub (Jul 15, 2021):

As far as I know you can request plain/text resources with Ajax and split the response with "\r\n".
I prefer to keep things simple if you don't mind.

<!-- gh-comment-id:880602819 --> @ngosang commented on GitHub (Jul 15, 2021): As far as I know you can request plain/text resources with Ajax and split the response with "\r\n". I prefer to keep things simple if you don't mind.
Author
Owner

@bmacho commented on GitHub (Jul 15, 2021):

You seem to be right, AJAX and CORS policy may allow scraping .txt files. (I don't find any specification, or even a stackoverflow question about it.)

This seem to work, with splitting with "\n\n":

var trackers_all_ws = []

function getTrackers() {
  var xhttp = new XMLHttpRequest()
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      trackers_all_ws = this.responseText.split("\n\n")
      trackers_all_ws.pop()
      console.log( trackers_all_ws )
    }
  };
  xhttp.open("GET", "https://ngosang.github.io/trackerslist/trackers_all_ws.txt", true)
  xhttp.send()
}

getTrackers()

Thank you!

<!-- gh-comment-id:880666722 --> @bmacho commented on GitHub (Jul 15, 2021): You seem to be right, AJAX and CORS policy may allow scraping .txt files. (I don't find any specification, or even a stackoverflow question about it.) This seem to work, with splitting with "\n\n": ``` var trackers_all_ws = [] function getTrackers() { var xhttp = new XMLHttpRequest() xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { trackers_all_ws = this.responseText.split("\n\n") trackers_all_ws.pop() console.log( trackers_all_ws ) } }; xhttp.open("GET", "https://ngosang.github.io/trackerslist/trackers_all_ws.txt", true) xhttp.send() } getTrackers() ``` Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/trackerslist-ngosang#279
No description provided.