Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extractors/youku: add password option #400

Merged
merged 1 commit into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,11 @@ $ annie -j https://www.bilibili.com/video/av20203945

```
-ccode string
Youku ccode (default "0103010102")
Youku ccode (default "0590")
-ckey string
Youku ckey (default "7B19C0AB12633B22E7FE81271162026020570708D6CC189E4924503C49D243A0DE6CD84A766832C2C99898FC5ED31F3709BB3CDD82C96492E721BDD381735026")
-password string
Youku password
```

#### YouTube
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ var (
YoukuCcode string
// YoukuCkey youku ckey
YoukuCkey string
// YoukuPassword youku password
YoukuPassword string
// RetryTimes how many times to retry when the download failed
RetryTimes int
// YouTubeStream2 will use data in `url_encoded_fmt_stream_map`
Expand Down
3 changes: 3 additions & 0 deletions extractors/youku/youku.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ func youkuUps(vid string) (youkuData, error) {
"https://ups.youku.com/ups/get.json?vid=%s&ccode=%s&client_ip=192.168.1.1&client_ts=%d&utid=%s&ckey=%s",
vid, ccode, time.Now().Unix()/1000, netURL.QueryEscape(utid), netURL.QueryEscape(config.YoukuCkey),
)
if config.YoukuPassword != "" {
url = fmt.Sprintf("%s&password=%s", url, config.YoukuPassword)
}
html, err = request.Get(url, youkuReferer, nil)
if err != nil {
return youkuData{}, err
Expand Down
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,19 @@ func init() {
"Playlist video items to download. Separated by commas like: 1,5,6",
)
flag.BoolVar(&config.Caption, "C", false, "Download captions")
flag.StringVar(&config.YoukuCcode, "ccode", "0103010102", "Youku ccode")
flag.IntVar(
&config.RetryTimes, "retry", 10, "How many times to retry when the download failed",
)
// youku
flag.StringVar(&config.YoukuCcode, "ccode", "0590", "Youku ccode")
flag.StringVar(
&config.YoukuCkey,
"ckey",
"7B19C0AB12633B22E7FE81271162026020570708D6CC189E4924503C49D243A0DE6CD84A766832C2C99898FC5ED31F3709BB3CDD82C96492E721BDD381735026",
"Youku ckey",
)
flag.IntVar(
&config.RetryTimes, "retry", 10, "How many times to retry when the download failed",
)
flag.StringVar(&config.YoukuPassword, "password", "", "Youku password")
// youtube
flag.BoolVar(&config.YouTubeStream2, "ytb-stream2", false, "Use data in url_encoded_fmt_stream_map")
}

Expand Down