Skip to content

Commit

Permalink
Added support for leviatanscans.com (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire authored Jan 18, 2023
1 parent 6316554 commit 81fdfc1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ files, so you can read them with your favorite ereader or reading app.
Supported sites
---------------

- Inmanga
- Mangadex
- Mangakakalot (+ any compatible sites)
- Manganato/Manganelo (+ any compatible sites)
- TCBScans
- [Inmanga](https://inmanga.com)
- [LeviatanScans](https://leviatanscans.com)
- [Mangadex](https://mangadex.org)
- [Manganato](https://manganato.com) (aka manganelo.com)
- [Mangakakalot](https://mangakakalot.com)
- [Manganelo.tv](https://ww5.manganelo.tv)
- [Manganelos](http://manganelos.com)
- [TCBScans](https://www.tcbscans.net)

If you'd like support for a specific site, [create a new issue][issues] or even
a PR with the changes.
Expand Down
2 changes: 1 addition & 1 deletion grabber/manganelo.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (m *Manganelo) Test() (bool, error) {
}

// for the same priority reasons, we need to iterate over the selectors
// using a simple `,` joining all selectors would resturn missmatches
// using a simple `,` joining all selectors would return missmatches
for _, selector := range selectors {
rows := m.doc.Find(selector)
if rows.Length() > 0 {
Expand Down
8 changes: 6 additions & 2 deletions grabber/tcb.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ func (t *Tcb) FetchTitle() (string, error) {
func (t Tcb) FetchChapters() (chapters Filterables, errs []error) {
t.chaps.Each(func(i int, s *goquery.Selection) {
// fetch title (usually "Chapter N")
title := strings.TrimSpace(s.Find("a").Text())
link := s.Find("a")
if len(link.Children().Nodes) > 0 {
link.Children().Remove()
}
title := strings.TrimSpace(link.Text())
re := regexp.MustCompile(`(\d+\.?\d*)`)
ns := re.FindString(title)
num, err := strconv.ParseFloat(ns, 64)
Expand Down Expand Up @@ -126,7 +130,7 @@ func (t Tcb) FetchChapter(f Filterable) (*Chapter, error) {
}
pages := []Page{}
pimages.Each(func(i int, s *goquery.Selection) {
u := strings.TrimSpace(s.AttrOr("data-src", ""))
u := strings.TrimSpace(s.AttrOr("data-src", s.AttrOr("src", "")))
n := int64(i + 1)
if u == "" {
// this error is not critical and is not from our side, so just log it out
Expand Down
4 changes: 2 additions & 2 deletions http/request.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package http

import (
"errors"
"fmt"
"io"
"net/http"
)
Expand Down Expand Up @@ -46,7 +46,7 @@ func request(t string, params Params) (body io.ReadCloser, err error) {
}

if resp.StatusCode != 200 {
err = errors.New("received non 200 response code")
err = fmt.Errorf("received %d response code", resp.StatusCode)
return
}

Expand Down
6 changes: 5 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else
go test -v ./...
endif

grabber: grabber/manganelo grabber/inmanga grabber/mangadex
grabber: grabber/manganelo grabber/inmanga grabber/mangadex grabber/tcb

grabber/manganelo:
go run . https://mangakakalot.com/manga/vd921334 7
Expand All @@ -46,3 +46,7 @@ grabber/inmanga:

grabber/mangadex:
go run . https://mangadex.org/title/a1c7c817-4e59-43b7-9365-09675a149a6f/one-piece --language es 1-4 --bundle

grabber/tcb:
go run . https://www.tcbscans.net/manga/one-piece/ 5
go run . https://en.leviatanscans.com/home/manga/i-became-the-male-leads-adopted-daughter/ 5

0 comments on commit 81fdfc1

Please sign in to comment.