Skip to content

Commit

Permalink
Support new vod url
Browse files Browse the repository at this point in the history
  • Loading branch information
jybp committed Jul 11, 2024
1 parent 1ee750c commit c01f13b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
16 changes: 5 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@ builds:
ldflags: -X main.defaultClientID=kimne78kx3ncx6brgo4mv6wki5h1ko
archives:
- id: "archives"
name_template: >-
{{- .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end -}}
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^test:"
env_files:
github_token: ./github_token
github_token: ./github_token
2 changes: 1 addition & 1 deletion twitch/twitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func ID(URL string) (string, VideoType, error) {
if !strings.Contains(u.Hostname(), "twitch.tv") {
return "", 0, errors.Errorf("URL host for %s is not twitch.tv", URL)
}
if strings.HasPrefix(u.Path, "/videos/") {
if strings.HasPrefix(u.Path, "/videos/") || strings.Contains(u.Path, "/video/") {
_, id := path.Split(u.Path)
return id, TypeVOD, nil
}
Expand Down
5 changes: 5 additions & 0 deletions twitch/twitch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ func TestID(t *testing.T) {
expectedID: "12345",
expectedType: twitch.TypeVOD,
},
{
input: "https://www.twitch.tv/letsgameitout/video/2182428086",
expectedID: "2182428086",
expectedType: twitch.TypeVOD,
},
{
input: "https://www.twitch.tv/test/clip/Slug123",
expectedID: "Slug123",
Expand Down

0 comments on commit c01f13b

Please sign in to comment.