mirror of
https://github.com/NohamR/papeer.git
synced 2026-05-26 04:17:21 +00:00
fix: selector depth
This commit is contained in:
@@ -137,7 +137,7 @@ go get -u github.com/lapwat/papeer
|
|||||||
```sh
|
```sh
|
||||||
# use platform=darwin for MacOS
|
# use platform=darwin for MacOS
|
||||||
platform=linux
|
platform=linux
|
||||||
release=0.4.0
|
release=0.4.1
|
||||||
|
|
||||||
# download and extract
|
# download and extract
|
||||||
curl -L https://github.com/lapwat/papeer/releases/download/v$release/papeer-v$release-$platform-amd64.tar.gz > papeer.tar.gz
|
curl -L https://github.com/lapwat/papeer/releases/download/v$release/papeer-v$release-$platform-amd64.tar.gz > papeer.tar.gz
|
||||||
@@ -150,7 +150,7 @@ sudo mv papeer /usr/local/bin
|
|||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
Download [latest release](https://github.com/lapwat/papeer/releases/download/v0.4.0/papeer-v0.4.0-windows-amd64.exe.zip).
|
Download [latest release](https://github.com/lapwat/papeer/releases/download/v0.4.1/papeer-v0.4.1-windows-amd64.exe.zip).
|
||||||
|
|
||||||
## MOBI support
|
## MOBI support
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ var getCmd = &cobra.Command{
|
|||||||
return errors.New("cannot use threads option if depth/selector is not specified")
|
return errors.New("cannot use threads option if depth/selector is not specified")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cmd.Flags().Changed("use-link-name") && getOpts.depth == 0 && len(getOpts.Selector) == 0 {
|
||||||
|
return errors.New("cannot use use-link-name option if depth/selector is not specified")
|
||||||
|
}
|
||||||
|
|
||||||
if cmd.Flags().Changed("delay") && cmd.Flags().Changed("threads") {
|
if cmd.Flags().Changed("delay") && cmd.Flags().Changed("threads") {
|
||||||
return errors.New("cannot use delay and threads options at the same time")
|
return errors.New("cannot use delay and threads options at the same time")
|
||||||
}
|
}
|
||||||
@@ -114,9 +118,11 @@ var getCmd = &cobra.Command{
|
|||||||
url := args[0]
|
url := args[0]
|
||||||
|
|
||||||
// fill selector array with empty selectors to match depth
|
// fill selector array with empty selectors to match depth
|
||||||
for len(getOpts.Selector) < getOpts.depth+2 {
|
getOpts.Selector = append(getOpts.Selector, "")
|
||||||
|
for len(getOpts.Selector) < getOpts.depth+1 {
|
||||||
getOpts.Selector = append(getOpts.Selector, "")
|
getOpts.Selector = append(getOpts.Selector, "")
|
||||||
}
|
}
|
||||||
|
fmt.Println(len(getOpts.Selector))
|
||||||
|
|
||||||
// generate config for each level
|
// generate config for each level
|
||||||
configs := make([]*book.ScrapeConfig, len(getOpts.Selector))
|
configs := make([]*book.ScrapeConfig, len(getOpts.Selector))
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ var versionCmd = &cobra.Command{
|
|||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "Print the version number of papeer",
|
Short: "Print the version number of papeer",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println("papeer v0.4.0")
|
fmt.Println("papeer v0.4.1")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user