Skip to content

Instantly share code, notes, and snippets.

@lxt2
Created September 17, 2016 05:16
Show Gist options
  • Save lxt2/0d0b414169309ea8c686286ca2fa20e7 to your computer and use it in GitHub Desktop.
Save lxt2/0d0b414169309ea8c686286ca2fa20e7 to your computer and use it in GitHub Desktop.
An indexer definition for speed.cd for cardigann
---
site: speedcd
name: Speed.CD
language: en-us
links:
- https://???
caps:
categories:
# TBD
modes:
tv-search: [q, season, ep]
login:
path: /login.php
form: form
inputs:
username: "{{ .Config.username }}"
password: "{{ .Config.password }}"
# error:
# - selector: h1:contains("Error:")
# message:
# selector: "#login p"
# remove: style, b
test:
path: /profile.php
search:
path: /browse.php
inputs:
search: "{{ .Query.Keywords }}"
rows:
selector: "#torrentTable .boxContent > table tbody tr"
fields:
category:
selector: td:nth-child(1) > a:nth-child(1)
attribute: href
filters:
- name: querystring
args: cat
# title:
# selector: a.torrent_name_link
# attribute: title
# details:
# selector: a.torrent_name_link
# attribute: href
# comments:
# selector: a.torrent_name_link
# attribute: href
# download:
# selector: td.table_links a:nth-child(1)
# attribute: href
# size:
# selector: td.table_size
# remove: br
# date:
# selector: td.table_added
# remove: br
# filters:
# - name: reltime
# args: 02-Jan-2006
# - name: dateparse
# args: 02-Jan-2006 15:04:05
# seeders:
# selector: td.table_seeders a span
# leechers:
# selector: td.table_leechers a
@subzero79
Copy link

subzero79 commented Sep 19, 2016

Maybe also the logs helps,

INFO[0000] Listening on 0.0.0.0:5060                    
DEBU[0005] GET /                                         method=GET path=/ remote=[::1]:50513
DEBU[0005] GET /static/css/main.1ab9c9d3.css             method=GET path=/static/css/main.1ab9c9d3.css remote=[::1]:50513
DEBU[0005] GET /static/js/main.b0410800.js               method=GET path=/static/js/main.b0410800.js remote=[::1]:50514
DEBU[0006] GET /xhr/auth                                 method=GET path=/xhr/auth remote=[::1]:50517
DEBU[0006] GET /static/media/cardigann.11a25e34.gif      method=GET path=/static/media/cardigann.11a25e34.gif remote=[::1]:50514
DEBU[0006] GET /static/media/glyphicons-halflings-regular.448c34a5.woff2  method=GET path=/static/media/glyphicons-halflings-regular.448c34a5.woff2 remote=[::1]:50514
DEBU[0006] GET /xhr/indexers                             method=GET path=/xhr/indexers remote=[::1]:50517
DEBU[0006] Authenticating request                        method=header
DEBU[0007] GET /favicon.ico                              method=GET path=/favicon.ico remote=[::1]:50514
DEBU[0008] GET /xhr/indexers/speedcd/test                method=GET path=/xhr/indexers/speedcd/test remote=[::1]:50517
DEBU[0008] Authenticating request                        method=header
DEBU[0008] Loaded indexer                                indexer=speedcd
INFO[0008] Testing search mode "tv-search"              
DEBU[0008] Testing if login is needed                    path={Path:/user} site=speedcd
DEBU[0008] Checking connectivity to url                  site=speedcd url=http://speed.cd/
DEBU[0013] Resolving url                                 base=http://speed.cd/ site=speedcd u=http://speed.cd/user
DEBU[0013] Opening page                                  site=speedcd url=http://speed.cd/user
DEBU[0013] Finished request                              code=404 page=http://speed.cd/user site=speedcd
DEBU[0013] Wrote page output to cache                    file=file:///var/folders/lb/63qs_9gd789g42ykvk166jfm0000gq/T/speedcd308106863 site=speedcd
DEBU[0013] No login needed, already logged in            site=speedcd
DEBU[0013] Resolved torznab cats to local                local=[51 2 49 52] querycats=[5040 5030] site=speedcd
DEBU[0013] Resolving url                                 base=http://speed.cd/user site=speedcd u=http://speed.cd/browse.php
INFO[0013] Searching indexer                             query=cat=5040%2C5030&limit=5&t=tv-search site=speedcd
DEBU[0013] Opening page                                  site=speedcd url=http://speed.cd/browse.php?search=halt+catch
DEBU[0017] Finished request                              code=200 page=http://speed.cd/login.php site=speedcd
DEBU[0017] Wrote page output to cache                    file=file:///var/folders/lb/63qs_9gd789g42ykvk166jfm0000gq/T/speedcd969659138 site=speedcd
DEBU[0017] Found 0 rows                                  limit=5 offset=0 rows=0 selector=#torrentTable .boxContent > table tbody tr site=speedcd
INFO[0017] Query returned 0 results                      site=speedcd time=3.783540198s

It thinks is already logged in, so i need to define better the error speed will output in case of test

@subzero79
Copy link

Ok the login now works should be

  login:
    path: /takeElogin.php
    method: post
    inputs:
      username: "{{ .Config.username }}"
      password: "{{ .Config.password }}"
    error:
      - selector: tbody:contains("File Not Found")
    test:
      path: /user/

Now the output of test comes out like this

  <td class="typecol">
    <div>
      <div id="book932359" class="book" title="Bookmark" data-type="bok&amp;id=932359">
        <img src="/V3/img/.gif" class="icos heart"/>
      </div>
      <a id="2" href="?cat=2" class="cat">
        <img border="0" class="Tcat c2" src="/V3/img/.gif" alt="TV/Episodes"/>
      </a>
    </div>
  </td>
  <td class="lft" colspan="2">
    <div>
      <a href="/t/932359" class="torrent" id="932359">
        <b>
          La Liga 2016 09 10 Sevilla vs Las Palmas 480p x264-mSD
        </b>
      </a>
      <span class="nTag hO">
        NEW!
      </span>
      <span class="date">
         Uploaded 
        <span class="elapsedDate run" data-x="1474771123" title="Sunday, September 25, 2016 at 3:11am">
          3 minutes ago
        </span>
      </span>
    </div>
  </td>
  <td>
    <a href="download.php?torrent=932359">
      <img title="Download" alt="Download" src="/V3/img/.gif" class="icos save"/>
    </a>
  </td>
  <td class="comment">
    0
  </td>
  <td>
    1.36
    <br/>
    GB
  </td>
  <td>
    <b>
      1
    </b>
  </td>
  <td>
    0
  </td>
</tr> 

I am lost here on how to organize the search yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment