Skip to content

Commit

Permalink
fixes for comicextra and builds
Browse files Browse the repository at this point in the history
fix typo
  • Loading branch information
Girbons committed Feb 28, 2024
1 parent 7944b34 commit 90322c0
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.18
- 1.22

before_install:
- sudo apt-get update
Expand Down
31 changes: 23 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
<a name="v0.33.7"></a>
[Changes][v0.33.9]
# [0.33.9 (v0.33.9)](https://github.com/Girbons/comics-downloader/releases/tag/v0.33.9) - 28 Feb 2024

# Fixes

- #131: added support to new comicextra domain, fixed error that was overwriting issues
- #134: fixed error for readcomiconline image deobfuscateUrl
- #144: fixed linux build
- #145: fixed error for comicextra

## Dev

- bump go to 1.22
- updated dependencies

# [0.33.7 (v0.33.7)](https://github.com/Girbons/comics-downloader/releases/tag/v0.33.5) - 20 Aug 2023
[Changes][v0.33.8]
# [0.33.8 (v0.33.8)](https://github.com/Girbons/comics-downloader/releases/tag/v0.33.8) - 5 Jan 2024

# Fixes

- #131: Fixed comicextra url
- #131: added support to new comicextra domain, fixed error that was overwriting issues
- #134: fixed error for readcomiconline image deobfuscateUrl

<a name="v0.33.6"></a>
[Changes][v0.33.7]
# [0.33.7 (v0.33.7)](https://github.com/Girbons/comics-downloader/releases/tag/v0.33.7) - 20 Aug 2023

# [0.33.6 (v0.33.6)](https://github.com/Girbons/comics-downloader/releases/tag/v0.33.5) - 3 Jul 2023
# Fixes

- #131: added support to new comicextra domain, fixed error that was overwriting issues
- #134: fixed error for readcomiconline image deobfuscateUrl

## Dev

- updated dependencies

[Changes][v0.33.6]
# [0.33.6 (v0.33.6)](https://github.com/Girbons/comics-downloader/releases/tag/v0.33.6) - 3 Jul 2023

# Fixes

- #133: Fixed comicextra url
- #131: Fixed comicextra url

[Changes][v0.33.5]
<a name="v0.33.5"></a>
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ windows-x86-64-build: # Creates Windows
windows-386-build: # Creates Windows
@GOOS=windows GOARCH=386 go build -o build/comics-downloader-win-386.exe ./cmd/downloader

linux-build: # Creates Linux
@GOOS=linux go build -o build/comics-downloader ./cmd/downloader
linux-x86-64-build: # Creates Linux
@GOOS=linux GOARCH=amd64 go build -o build/comics-downloader-linux-x86-64 ./cmd/downloader

linux-386-build:
@GOOS=linux GOARCH=386 go build -o build/comics-downloader-linux-386 ./cmd/downloader
Expand All @@ -39,11 +39,11 @@ builds: # Creates executables for OSX/Windows/Linux
@make linux-386-build
@make linux-arm-build
@make linux-arm64-build
@make linux-build
@make linux-x86-64-build
@make osx-build-arm
@make osx-build-x86-64
@windows-x86-64-build
@windows-386-build
@make windows-x86-64-build
@make windows-386-build
@make osx-gui-build
@make linux-gui-build
@make windows-gui-build
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@

Download the latest release:

- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader)
- [Linux (386)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-linux-386)
- [Mac OSX (Arm64)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-osx-arm)
- [Mac OSX (x86-64)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-osx-x86-64)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader.exe)
- [Windows (386)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-win-386.exe)
- [Windows (x86-64)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-win-x86-64.exe)
- [Linux ARM](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-linux-arm)
- [Linux ARM64](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-linux-arm64)
- [Linux (x86-64)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-linux-x86-64)
- [Linux (386)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-linux-386)
- [Mac OSX (Arm64)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-osx-arm)
- [Mac OSX (x86-64)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-osx-x86-64)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader.exe)
- [Windows (386)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-win-386.exe)
- [Windows (x86-64)](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-win-x86-64.exe)
- [Linux ARM](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-linux-arm)
- [Linux ARM64](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-linux-arm64)

Download the latest GUI release:

- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-gui)
- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-gui-osx)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.33.8/comics-downloader-gui-windows.exe)
- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-gui)
- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-gui-osx)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.33.9/comics-downloader-gui-windows.exe)

## Usage

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Girbons/comics-downloader

go 1.21.0
go 1.22.0

require (
fyne.io/fyne v1.4.3
Expand All @@ -13,7 +13,7 @@ require (
github.com/schollz/progressbar/v2 v2.15.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
golang.org/x/mod v0.14.0
golang.org/x/mod v0.15.0
golang.org/x/sync v0.6.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+o
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// Tag specifies the current release tag.
// It needs to be manually updated.
const Tag = "v0.33.8"
const Tag = "v0.33.9"

// IsNewAvailable will fetch the latest project releases
// and will compare the latest release Tag against the current Tag.
Expand Down
4 changes: 4 additions & 0 deletions pkg/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ func (comic *Comic) makeCBRZ(options *config.Options) error {

// DownloadImages will download the comic/manga images
func (comic *Comic) DownloadImages(options *config.Options) (string, error) {
if len(comic.Links) == 0 {
return "", fmt.Errorf("Download failed, no links found for:", comic.URLSource)
}

var dir string
var err error

Expand Down
70 changes: 28 additions & 42 deletions pkg/sites/comicextra.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,73 +86,58 @@ func (c *Comicextra) retrieveLastIssue(url string) (string, error) {
func (c *Comicextra) RetrieveIssueLinks() ([]string, error) {
url := c.options.URL

splittedUrl := util.TrimAndSplitURL(url)

comicName := splittedUrl[3]

if c.options.Last {
issue, err := c.retrieveLastIssue(url)
return []string{issue}, err
}

// check if the user has submitted a generic url
if !strings.HasSuffix(url, "/issue") {
// enable `-all` flag in this case
c.options.Logger.Warning("URL does not contain a specific issue, `-all` flag will be automaticcaly enabled")
c.options.All = true
}

if c.options.All && c.isSingleIssue(url) {
url = "https://" + c.options.Source + "/comic" + util.TrimAndSplitURL(url)[3]
url = "https://" + c.options.Source + "/comic/" + comicName
} else if c.isSingleIssue(url) {

if !strings.HasSuffix(url, "/full") {
url = url + "/full"
}

return []string{url}, nil
}

// retrieve pages before

name := util.TrimAndSplitURL(url)[4]
var (
pages []string
links []string
elements []soup.Root
)

// do not handle pagination
// remove the page that comes within the url
parts := strings.Split(url, "/")
if len(parts) >= 6 {
url = parts[0] + "//" + parts[2] + "/" + parts[3] + "/" + parts[4]
}

// and start from 1
pages = append(pages, url+"/1")

response, err := soup.Get(url)
if err != nil {
return nil, err
}

doc := soup.HTMLParse(response)

pagesDiv := doc.Find("div", "class", "general-nav")
if pagesDiv.Pointer != nil {
elements = pagesDiv.FindAll("a")
episodeList := doc.Find("div", "class", "episode-list")
if episodeList.Pointer != nil {
elements = episodeList.FindAll("a")
}

for _, element := range elements {
pageURL := element.Attrs()["href"]
if !strings.Contains(pageURL, "onclick") && !util.IsValueInSlice(pageURL, pages) {
pages = append(pages, pageURL)
}
}

re := regexp.MustCompile("<a[^>]+href=\"([^\">]+" + "/" + name + "/.+)\"")

for _, pageURL := range pages {
response, err := soup.Get(pageURL)
if err != nil {
return nil, err
}

match := re.FindAllStringSubmatch(response, -1)

for i := range match {
url := match[i][1]
if !strings.Contains(url, "onclick") && !util.IsValueInSlice(url, pages) {
url = url + "/full"
if util.IsURLValid(url) && !util.IsValueInSlice(url, links) {
links = append(links, url)
}
if !strings.Contains(pageURL, "onclick") && !util.IsValueInSlice(pageURL, links) {
if !strings.HasSuffix(pageURL, "/full") {
pageURL = pageURL + "/full"
}

links = append(links, pageURL)
}
}

Expand All @@ -166,8 +151,9 @@ func (c *Comicextra) RetrieveIssueLinks() ([]string, error) {
// GetInfo extracts the basic info from the given url.
func (c *Comicextra) GetInfo(url string) (string, string) {
parts := util.TrimAndSplitURL(url)
name := parts[4]
issueNumber := parts[5]

name := parts[3]
issueNumber := parts[4]

return name, issueNumber
}
Expand Down
31 changes: 15 additions & 16 deletions pkg/sites/comicextra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

func TestComicExtraSetup(t *testing.T) {
comic := new(core.Comic)
comic.URLSource = "https://comicextra.net/comic/batman-unseen/issue-5/full"
comic.URLSource = "https://comicextra.me/batman-unseen/issue-5/full"

opt :=
&config.Options{
URL: "https://comicextra.net/comic/batman-unseen/issue-5",
URL: "https://comicextra.me/batman-unseen/issue-5/full",
All: false,
Last: false,
Debug: false,
Expand All @@ -32,15 +32,15 @@ func TestComicExtraSetup(t *testing.T) {
func TestComicExtraGetInfo(t *testing.T) {
opt :=
&config.Options{
URL: "https://comicextra.net/comic/batman-unseen/issue-5",
URL: "https://comicextra.me/batman-unseen/issue-5/full",
All: false,
Last: false,
Debug: false,
Logger: logger.NewLogger(false, make(chan string)),
}

comicextra := NewComicextra(opt)
name, issueNumber := comicextra.GetInfo("https://comicextra.net/comic/batman-unseen/issue-5")
name, issueNumber := comicextra.GetInfo("https://comicextra.me/batman-unseen/issue-5/full")

assert.Equal(t, "batman-unseen", name)
assert.Equal(t, "issue-5", issueNumber)
Expand All @@ -49,7 +49,7 @@ func TestComicExtraGetInfo(t *testing.T) {
func TestComicextraRetrieveIssueLinks(t *testing.T) {
opt :=
&config.Options{
URL: "https://comicextra.net/comic/batman-unseen/issue-5",
URL: "https://comicextra.me/batman-unseen/issue-5/full",
All: false,
Last: false,
Debug: false,
Expand All @@ -60,13 +60,13 @@ func TestComicextraRetrieveIssueLinks(t *testing.T) {
issues, err := comicextra.RetrieveIssueLinks()

assert.Nil(t, err)
assert.Equal(t, 5, len(issues))
assert.Equal(t, 1, len(issues))
}

func TestComicextraRetrieveIssueLinksURLWithPage(t *testing.T) {
opt :=
&config.Options{
URL: "https://comicextra.net/comic/batman-unseen",
URL: "https://comicextra.me/batman-unseen/full",
All: false,
Last: false,
Debug: false,
Expand All @@ -77,13 +77,13 @@ func TestComicextraRetrieveIssueLinksURLWithPage(t *testing.T) {
issues, err := comicextra.RetrieveIssueLinks()

assert.Nil(t, err)
assert.Equal(t, 5, len(issues))
assert.Equal(t, 1, len(issues))
}

func TestComicextraRetrieveIssueLinksInASinglePage(t *testing.T) {
opt :=
&config.Options{
URL: "https://comicextra.net/comic/batman-unseen/issue-4/full",
URL: "https://comicextra.me/batman-unseen/issue-4/full",
All: false,
Last: false,
Debug: false,
Expand All @@ -94,13 +94,13 @@ func TestComicextraRetrieveIssueLinksInASinglePage(t *testing.T) {
issues, err := comicextra.RetrieveIssueLinks()

assert.Nil(t, err)
assert.Equal(t, 5, len(issues))
assert.Equal(t, 1, len(issues))
}

func TestComicextraRetrieveIssueLinksLastChapter(t *testing.T) {
opt :=
&config.Options{
URL: "https://comicextra.net/comic/batman-unseen/issue-4/full",
URL: "https://comicextra.me/batman-unseen/issue-4/full",
All: false,
Last: true,
Debug: false,
Expand All @@ -116,17 +116,16 @@ func TestComicextraRetrieveIssueLinksLastChapter(t *testing.T) {

func TestComicExtraRetrieveLastIssueLink(t *testing.T) {
comicextra := new(Comicextra)
issue, err := comicextra.retrieveLastIssue("https://comicextra.net/comic/batman-unseen/issue-1/full")
issue, err := comicextra.retrieveLastIssue("https://comicextra.me/batman-unseen/issue-1/full")

assert.Nil(t, err)
assert.Equal(t, "https://comicextra.net/comic/batman-unseen/issue-5/full", issue)
assert.Equal(t, "https://comicextra.me/batman-unseen/issue-5/full", issue)
}

func TestComicExtraRetrieveLastIssueLinkNotDetail(t *testing.T) {
comicextra := new(Comicextra)
issue, err := comicextra.retrieveLastIssue("https://comicextra.net/comic/batman-unseen/issue-1/full")

issue, err := comicextra.retrieveLastIssue("https://comicextra.me/batman-unseen/issue-1/full")

assert.Nil(t, err)
assert.Equal(t, "https://comicextra.net/comic/batman-unseen/issue-5/full", issue)
assert.Equal(t, "https://comicextra.me/batman-unseen/issue-5/full", issue)
}
Loading

0 comments on commit 90322c0

Please sign in to comment.