Skip to content

Commit

Permalink
(*)refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Dec 1, 2017
1 parent 32d7fe2 commit 5c526f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
20 changes: 2 additions & 18 deletions biquge.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,6 @@ import (
"github.com/dfordsoft/golib/ic"
)

type tocPattern struct {
host string
bookTitle string
bookTitlePos int
item string
articleTitlePos int
articleURLPos int
isAbsoluteURL bool
}

type pageContentMarker struct {
host string
start []byte
end []byte
}

func init() {
dl := func(u string, tocPatterns []tocPattern, pageContentMarkers []pageContentMarker) {
dlPage := func(u string) (c []byte) {
Expand All @@ -47,7 +31,7 @@ func init() {
return
}

if bytes.Index(c, []byte("utf-8")) < 0 {
if bytes.Index(c, []byte("charset=gbk")) > 0 {
c = ic.Convert("gbk", "utf-8", c)
}
c = bytes.Replace(c, []byte("\r\n"), []byte(""), -1)
Expand Down Expand Up @@ -89,7 +73,7 @@ func init() {
}

b = bytes.Replace(b, []byte("</dd>"), []byte("</dd>\n"), -1)
if bytes.Index(b, []byte("utf-8")) < 0 {
if bytes.Index(b, []byte("charset=gbk")) > 0 {
b = ic.Convert("gbk", "utf-8", b)
}

Expand Down
16 changes: 16 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ import (
"strings"
)

type tocPattern struct {
host string
bookTitle string
bookTitlePos int
item string
articleTitlePos int
articleURLPos int
isAbsoluteURL bool
}

type pageContentMarker struct {
host string
start []byte
end []byte
}

type novelSiteHandler struct {
Title string
MatchPatterns []string
Expand Down

0 comments on commit 5c526f9

Please sign in to comment.