Skip to content

Commit 0dcd24a

Browse files
committed
Expose getStreamURL for use elsewhere
1 parent e074941 commit 0dcd24a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

client.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,19 @@ func (c *Client) GetStream(video *Video, format *Format) (*http.Response, error)
5757

5858
// GetStreamContext returns the HTTP response for a specific format with a context
5959
func (c *Client) GetStreamContext(ctx context.Context, video *Video, format *Format) (*http.Response, error) {
60-
url, err := c.getStreamURL(ctx, video, format)
60+
url, err := c.GetStreamURLContext(ctx, video, format)
6161
if err != nil {
6262
return nil, err
6363
}
6464

6565
return c.httpGet(ctx, url)
6666
}
6767

68-
func (c *Client) getStreamURL(ctx context.Context, video *Video, format *Format) (string, error) {
68+
func (c *Client) GetStreamURL(video *Video, format *Format) (string, error) {
69+
return c.GetStreamURLContext(context.Background(), video, format)
70+
}
71+
72+
func (c *Client) GetStreamURLContext(ctx context.Context, video *Video, format *Format) (string, error) {
6973
if format.URL != "" {
7074
return format.URL, nil
7175
}

video_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestDownload_Regular(t *testing.T) {
6969
format = &video.Formats[0]
7070
}
7171

72-
url, err := testClient.getStreamURL(ctx, video, format)
72+
url, err := testClient.GetStreamURLContext(ctx, video, format)
7373
require.NoError(err)
7474
require.NotEmpty(url)
7575
})

0 commit comments

Comments
 (0)