Skip to content

Commit

Permalink
new: feat: add page indexing queryparam (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemarinho97 authored Dec 11, 2024
1 parent a6c3d3e commit 0a702d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
7 changes: 5 additions & 2 deletions api/bludv.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

var bludv = IndexerMeta{
URL: "https://bludvfilmes.tv/",
URL: "https://bludv.xyz/",
SearchURL: "?s=",
}

Expand All @@ -33,14 +33,17 @@ func (i *Indexer) HandlerBluDVIndexer(w http.ResponseWriter, r *http.Request) {
}()

ctx := r.Context()
// supported query params: q, season, episode, filter_results
// supported query params: q, season, episode, page, filter_results
q := r.URL.Query().Get("q")
page := r.URL.Query().Get("page")

// URL encode query param
q = url.QueryEscape(q)
url := bludv.URL
if q != "" {
url = fmt.Sprintf("%s%s%s", url, bludv.SearchURL, q)
} else if page != "" {
url = fmt.Sprintf("%spage/%s", url, page)
}

fmt.Println("URL:>", url)
Expand Down
5 changes: 4 additions & 1 deletion api/comando_torrents.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ func (i *Indexer) HandlerComandoIndexer(w http.ResponseWriter, r *http.Request)
}()

ctx := r.Context()
// supported query params: q, season, episode
// supported query params: q, season, episode, page, filter_results
q := r.URL.Query().Get("q")
page := r.URL.Query().Get("page")

// URL encode query param
q = url.QueryEscape(q)
url := comando.URL
if q != "" {
url = fmt.Sprintf("%s%s%s", url, comando.SearchURL, q)
} else if page != "" {
url = fmt.Sprintf("%spage/%s", url, page)
}

fmt.Println("URL:>", url)
Expand Down
3 changes: 3 additions & 0 deletions api/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func HandlerIndex(w http.ResponseWriter, r *http.Request) {
"description": "Indexer for comando torrents",
"query_params": map[string]string{
"q": "search query",
"page": "page number",
"filter_results": "if results with similarity equals to zero should be filtered (true/false)",
},
},
Expand All @@ -75,12 +76,14 @@ func HandlerIndex(w http.ResponseWriter, r *http.Request) {
"description": "Indexer for bludv",
"query_params": map[string]string{
"q": "search query",
"page": "page number",
"filter_results": "if results with similarity equals to zero should be filtered (true/false)",
}},
},
"/indexers/torrent-dos-filmes": []map[string]interface{}{
{
"method": "GET",
"page": "page number",
"description": "Indexer for Torrent dos Filmes",
"query_params": map[string]string{
"q": "search query",
Expand Down
5 changes: 4 additions & 1 deletion api/torrent_dos_filmes.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@ func (i *Indexer) HandlerTorrentDosFilmesIndexer(w http.ResponseWriter, r *http.
}()

ctx := r.Context()
// supported query params: q, season, episode, filter_results
// supported query params: q, season, episode, page, filter_results
q := r.URL.Query().Get("q")
page := r.URL.Query().Get("page")

// URL encode query param
q = url.QueryEscape(q)
url := torrent_dos_filmes.URL
if q != "" {
url = fmt.Sprintf("%s%s%s", url, torrent_dos_filmes.SearchURL, q)
} else if page != "" {
url = fmt.Sprintf("%spage/%s", url, page)
}

fmt.Println("URL:>", url)
Expand Down

0 comments on commit 0a702d1

Please sign in to comment.