Skip to content

Commit

Permalink
# fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
udoless committed May 24, 2022
1 parent ccf6e64 commit fcd6b2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ geektime-dl [OPTIONS] command
help, h 帮助
```

### 登录

通过账号密码登录:

```console
$ geektime-dl login --phone xxxxxx --password xxxxxx
极客时间账号登录成功: XXX
```

通过Cookie登录:

```console
$ geektime-dl login --gcid xxxxxx --gcess xxxxxx --serverId 'xxxxxxx'
极客时间账号登录成功: XXX
```

### 视频和专栏的下载

Expand Down Expand Up @@ -146,21 +161,6 @@ $ geektime-dl video

存在 `.download` 临时文件,使用相同的参数执行 `geektime-dl` 命令,则下载进度将从上一个会话恢复。

### 登录

通过账号密码登录:

```console
$ geektime-dl login --phone xxxxxx --password xxxxxx
极客时间账号登录成功: XXX
```

通过Cookie登录:

```console
$ geektime-dl login --gcid xxxxxx --gcess xxxxxx --serverId 'xxxxxxx'
极客时间账号登录成功: XXX
```

## 参考仓库

Expand Down
6 changes: 5 additions & 1 deletion login/login_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ func NewLoginClient() *Client {
//InitLoginPage init
func (c *Client) InitLoginPage() {
res, _ := c.Get("https://account.geekbang.org/signin?redirect=https%3A%2F%2Ftime.geekbang.org%2F")
defer res.Body.Close()
defer (func() {
if res != nil {
res.Body.Close()
}
})()
}

//Login by phone and dpassword
Expand Down

0 comments on commit fcd6b2b

Please sign in to comment.