Skip to content

Commit

Permalink
Merge pull request #400 from iawia002/youku-password
Browse files Browse the repository at this point in the history
extractors/youku: add password option
  • Loading branch information
Xinzhao Xu authored Mar 2, 2019
2 parents 2f96aa9 + 7f06786 commit 59f2ae9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
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

0 comments on commit 59f2ae9

Please sign in to comment.