Skip to content

Commit

Permalink
Bilibili playlist episode can now be downloaded without the playlist …
Browse files Browse the repository at this point in the history
…title
  • Loading branch information
Stegosawr authored and Stegosawr committed Feb 29, 2020
1 parent f3ef980 commit beb712b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ You can use the `-start`, `-end` or `-items` option to specify the download rang
Playlist video items to download. Separated by commas like: 1,5,6,8-10
```

For bilibili playlists only:

```
-eto
File name of each bilibili episode doesn't include the playlist title
```

### Multiple inputs

You can also download multiple URLs at once:
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ var (
ItemEnd int
// Items Define wanted items from a file or playlist. Separated by commas like: 1,5,6,8-10
Items string
// File name of each bilibili episode doesn't include the playlist title
EpisodeTitleOnly bool
// Caption download captions
Caption bool
// YoukuCcode youku ccode
Expand Down
6 changes: 5 additions & 1 deletion extractors/bilibili/bilibili.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ func bilibiliDownload(options bilibiliOptions) downloader.Data {
}
title := parser.Title(doc)
if options.subtitle != "" {
title = fmt.Sprintf("%s P%d %s", title, options.page, options.subtitle)
if config.EpisodeTitleOnly {
title = fmt.Sprintf("P%d %s", options.page, options.subtitle)
} else {
title = fmt.Sprintf("%s P%d %s", title, options.page, options.subtitle)
}
}

err = downloader.Caption(
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func init() {
&config.Items, "items", "",
"Define wanted items from a file or playlist. Separated by commas like: 1,5,6,8-10",
)
flag.BoolVar(&config.EpisodeTitleOnly, "eto", false, "File name of each bilibili episode doesn't include the playlist title")
flag.BoolVar(&config.Caption, "C", false, "Download captions")
flag.IntVar(
&config.RetryTimes, "retry", 10, "How many times to retry when the download failed",
Expand Down

0 comments on commit beb712b

Please sign in to comment.