GithubHelp home page GithubHelp logo

t411-client's Introduction

t411-client

Go Report Card

[GoDoc] (https://godoc.org/github.com/dns-gh/t411-client/t411client)

t411-client is a Go web client for the t411 website API: https://api.t411.al/ (watch out for the domain name that can change over time)

Motivation

Used in https://github.com/dns-gh/torrents-bot

Feel free to join my efforts!

Installation

  • It requires Go language of course. You can set it up by downloading it here: https://golang.org/dl/
  • Install it here C:/Go.
  • Set your GOPATH, GOROOT and PATH environment variables:
export GOROOT=C:/Go
export GOPATH=WORKING_DIR
export PATH=C:/Go/bin:${PATH}
  • Download and install the package:
@working_dir $ go get github.com/dns-gh/t411-client/...
@working_dir $ go install github.com/dns-gh/t411-client/t411client

Example

TODO

Tests

For example:

@working_dir $ export T411_USERNAME=your_username && export T411_PASSWORD=your_password && go test ...t411client -gocheck.vv -test.v -gocheck.f Test
=== RUN   Test
START: categories_test.go:23: MySuite.TestCategoriesTree
one category with no id found
PASS: categories_test.go:23: MySuite.TestCategoriesTree 0.336s

START: torrents_test.go:147: MySuite.TestDownloadTorrentByID
PASS: torrents_test.go:147: MySuite.TestDownloadTorrentByID     1.102s

START: torrents_test.go:165: MySuite.TestDownloadTorrentByTerms
PASS: torrents_test.go:165: MySuite.TestDownloadTorrentByTerms  0.925s

START: torrents_test.go:14: MySuite.TestMakeURL
PASS: torrents_test.go:14: MySuite.TestMakeURL  0.000s

START: t411client_test.go:27: MySuite.TestNewT411
PASS: t411client_test.go:27: MySuite.TestNewT411        0.803s

START: torrents_test.go:94: MySuite.TestSearchAllTorrents
PASS: torrents_test.go:94: MySuite.TestSearchAllTorrents        0.887s

START: torrents_test.go:63: MySuite.TestSearchTorrentsByTerms
PASS: torrents_test.go:63: MySuite.TestSearchTorrentsByTerms    2.809s

START: torrents_test.go:105: MySuite.TestSearchTorrentsByTermsComplete
PASS: torrents_test.go:105: MySuite.TestSearchTorrentsByTermsComplete   0.727s

START: torrents_test.go:130: MySuite.TestSearchTorrentsSortingBySeeders
PASS: torrents_test.go:130: MySuite.TestSearchTorrentsSortingBySeeders  0.469s

START: terms_test.go:24: MySuite.TestTermsTree
PASS: terms_test.go:24: MySuite.TestTermsTree   0.278s

START: torrents_test.go:179: MySuite.TestTorrentsDetails
PASS: torrents_test.go:179: MySuite.TestTorrentsDetails 1.007s

START: users_test.go:7: MySuite.TestUsersProfile
PASS: users_test.go:7: MySuite.TestUsersProfile 1.280s

OK: 12 passed
--- PASS: Test (10.65s)
PASS
ok      github.com/dns-gh/t411-client/t411client        10.897s

LICENSE

See included LICENSE file.

t411-client's People

Contributors

dns-gh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

silvanosky

t411-client's Issues

special characters in URL

Deal with special characters in uri like '%':

[2017-01-06 23:55:42] trying HD 3% - season 1 complete
[2017-01-06 23:55:42] parse https://api.t411.li/torrents/search/3%: invalid URL escape "%"

could not a find a tv show with a slightly different name

Example: Travelers (2016) is search but only Travelers is used by tracker uploaders.
So:

  • Remove the year ? And count only on the match 'tracker added date' <-> 'released date'
  • search with the year then search without if not found ? (Make it an option/preference in the config file)

int to string fix method in json response

For the limit, offset and total field of a torrent, the default values are set as int in response, not string. Should be always one or the other. So we're going to transform the json raw response of those fields into string.

torrents/search response wrong format

sometimes we get a json response for the torrents/search endpoint of the form

[55235425]

this case is not handled by the fixJSONResponse helper and should be.

Is this case handled too:

[55235425, 55235426, ..., 55235430]

for example ?

search by episode is supposed to work from episode 1 to 60

the episode ids are not correct starting from 31 i think. See this sample from https://www.t411.li/torrents/terms/?subcat=433

<fieldset class="terms-type-46">
            <legend>Episode<span>&#8635</span></legend>
            <select name="term[46][]" class="multiple multiple-62" multiple>
                            <option value="936" > Saison complète</option>
                            <option value="937" >Episode 01</option>
                            <option value="938" >Episode 02</option>
                            <option value="939" >Episode 03</option>
                            <option value="940" >Episode 04</option>
                            <option value="941" >Episode 05</option>
                            <option value="942" >Episode 06</option>
                            <option value="943" >Episode 07</option>
                            <option value="944" >Episode 08</option>
                            <option value="946" >Episode 09</option>
                            <option value="947" >Episode 10</option>
                            <option value="948" >Episode 11</option>
                            <option value="949" >Episode 12</option>
                            <option value="950" >Episode 13</option>
                            <option value="951" >Episode 14</option>
                            <option value="952" >Episode 15</option>
                            <option value="954" >Episode 16</option>
                            <option value="953" >Episode 17</option>
                            <option value="955" >Episode 18</option>
                            <option value="956" >Episode 19</option>
                            <option value="957" >Episode 20</option>
                            <option value="958" >Episode 21</option>
                            <option value="959" >Episode 22</option>
                            <option value="960" >Episode 23</option>
                            <option value="961" >Episode 24</option>
                            <option value="962" >Episode 25</option>
                            <option value="963" >Episode 26</option>
                            <option value="964" >Episode 27</option>
                            <option value="965" >Episode 28</option>
                            <option value="966" >Episode 29</option>
                            <option value="967" >Episode 30</option>
                            <option value="1088" >Episode 31</option>
                            <option value="1089" >Episode 32</option>
                            <option value="1090" >Episode 33</option>
                            <option value="1091" >Episode 34</option>
                            <option value="1092" >Episode 35</option>
                            <option value="1093" >Episode 36</option>
                            <option value="1094" >Episode 37</option>
                            <option value="1095" >Episode 38</option>
                            <option value="1096" >Episode 39</option>
                            <option value="1097" >Episode 40</option>
                            <option value="1098" >Episode 41</option>
                            <option value="1099" >Episode 42</option>
                            <option value="1100" >Episode 43</option>
                            <option value="1101" >Episode 44</option>
                            <option value="1102" >Episode 45</option>
                            <option value="1103" >Episode 46</option>
                            <option value="1104" >Episode 47</option>
                            <option value="1105" >Episode 48</option>
                            <option value="1106" >Episode 49</option>
                            <option value="1107" >Episode 50</option>
                            <option value="1108" >Episode 51</option>
                            <option value="1109" >Episode 52</option>
                            <option value="1110" >Episode 53</option>
                            <option value="1111" >Episode 54</option>
                            <option value="1112" >Episode 55</option>
                            <option value="1113" >Episode 56</option>
                            <option value="1114" >Episode 57</option>
                            <option value="1115" >Episode 58</option>
                            <option value="1116" >Episode 59</option>
                            <option value="1117" >Episode 60</option>
                            <option value="1143" >Non communiqué</option>
                        </select>
        </fieldset>

search by quality

enable the search by video quality. See:

<fieldset class="terms-type-7">
            <legend>Qualité<span>&#8635</span></legend>
            <select name="term[7][]" class="multiple multiple-20" multiple>
                            <option value="8" >BDrip/BRrip [Rip SD (non HD) depuis Bluray ou HDrip]</option>
                            <option value="1171" >Bluray 4K [Full ou Remux]</option>
                            <option value="17" >Bluray [Full]</option>
                            <option value="1220" >Bluray [Remux]</option>
                            <option value="13" >DVD-R 5 [DVD < 4.37GB]</option>
                            <option value="14" >DVD-R 9 [DVD > 4.37GB]</option>
                            <option value="10" >DVDrip [Rip depuis DVD-R]</option>
                            <option value="16" >HDrip 1080 [Rip HD depuis Bluray]</option>
                            <option value="1219" >HDrip 4k [Rip HD 4k depuis source 4k]</option>
                            <option value="15" >HDrip 720 [Rip HD depuis Bluray]</option>
                            <option value="11" >TVrip [Rip SD (non HD) depuis Source Tv HD/SD]</option>
                            <option value="1162" >TVripHD 1080 [Rip HD depuis Source Tv HD]</option>
                            <option value="1235" >TvripHD 4k [Rip HD 4k depuis Source Tv 4k]</option>
                            <option value="12" >TVripHD 720 [Rip HD depuis Source Tv HD]</option>
                            <option value="18" >VCD/SVCD/VHSrip</option>
                            <option value="1233" >Web-Dl</option>
                            <option value="1174" >Web-Dl 1080</option>
                            <option value="1182" >Web-Dl 4K</option>
                            <option value="1175" >Web-Dl 720</option>
                            <option value="19" >WEBrip</option>
                        </select>
        </fieldset>

search all torrents with no query

It seems possible using the t411 api: /torrents/search/?offset=0&limit=200 for example, or with limit=300000 (seems to be the 'total' field maximum value)

it returns something like:

<div class="errorMessage">Missing argument 1 for App\Api\Controllers\TorrentsController::searchAction()</div>
<div class="errorMessage">Undefined variable: query</div>
<div class="errorMessage">Undefined variable: query</div>
{"query":null,"offset":"0","limit":"1","total":"300000","torrents":[{"id":"5622132","name":"Une Saison Au Zoo S06E21 WEB-DL 1080p","category":"639","rewritename":"une-saison-au-zoo-s06e21-web-dl-1080p","seeders":"1","leechers":"1","comments":"0","isVerified":"0","added":"2016-12-20 14:52:08","size":"845642605","times_completed":"0","owner":"107319745","categoryname":"Emission TV","categoryimage":"tv-show","username":"paquena71260","privacy":"normal"}]}

so we need to get rid of the html part first before unmarshaling the data.

add usage examples

add usage examples of some methods to be available in godoc for the reader.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.