mirror of
https://github.com/NohamR/papeer.git
synced 2026-05-25 12:27:20 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fd0a12620 |
@@ -141,7 +141,7 @@ go install github.com/lapwat/papeer@latest
|
||||
```sh
|
||||
# use platform=darwin for MacOS
|
||||
platform=linux
|
||||
release=0.6.1
|
||||
release=0.6.2
|
||||
|
||||
# download and extract
|
||||
curl -L https://github.com/lapwat/papeer/releases/download/v$release/papeer-v$release-$platform-amd64.tar.gz > papeer.tar.gz
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package book
|
||||
|
||||
type link struct {
|
||||
Href string `json:"href"`
|
||||
Href string `json:"url"`
|
||||
Text string `json:"name"`
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,12 @@ func GetLinks(url *urllib.URL, selector string, limit, offset int, reverse, incl
|
||||
// RSS feed
|
||||
|
||||
for _, item := range feed.Items {
|
||||
links = append(links, NewLink(item.Link, item.Title))
|
||||
u, err := url.Parse(item.Link)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
links = append(links, NewLink(u.String(), item.Title))
|
||||
}
|
||||
|
||||
pathMax = "RSS"
|
||||
@@ -385,11 +390,16 @@ func GetLinks(url *urllib.URL, selector string, limit, offset int, reverse, incl
|
||||
// visit and count link classes
|
||||
c := colly.NewCollector()
|
||||
c.OnHTML(selector, func(e *colly.HTMLElement) {
|
||||
href := e.Attr("href")
|
||||
text := strings.TrimSpace(e.Text)
|
||||
path := GetPath(e.DOM)
|
||||
key := path
|
||||
|
||||
u, err := url.Parse(e.Attr("href"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
href := u.String()
|
||||
|
||||
if selectorSet {
|
||||
|
||||
// if selector is set, we use the selector specified by the user
|
||||
|
||||
@@ -14,6 +14,6 @@ var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version number of papeer",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("papeer v0.6.1")
|
||||
fmt.Println("papeer v0.6.2")
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user