Skip to content

Commit d81863c

Browse files
committed
v1.0.7: Update API changes.
1 parent 53bf4aa commit d81863c

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

gobalt.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616
)
1717

1818
var (
19-
CobaltApi = "https://co.wuk.sh" //Override this value to use your own cobalt instance. See https://instances.hyper.lol/ for alternatives from the main instance.
20-
UserLanguage = "en" //Replace this following the ISO 639-1 standard. This downloads dubbed YouTube audio according to the language set here. Only takes effect if DubbedYoutubeAudio is set to true.
21-
useragent = fmt.Sprintf("Mozilla/5.0 (%v; %v); gobalt/v1.0.6 (%v; %v); +(https://github.com/lostdusty/gobalt)", runtime.GOOS, runtime.GOARCH, runtime.Compiler, runtime.Version())
19+
CobaltApi = "https://api.cobalt.tools" //Override this value to use your own cobalt instance. See https://instances.hyper.lol/ for alternatives from the main instance.
20+
UserLanguage = "en" //Replace this following the ISO 639-1 standard. This downloads dubbed YouTube audio according to the language set here. Only takes effect if DubbedYoutubeAudio is set to true.
21+
useragent = fmt.Sprintf("Mozilla/5.0 (%v; %v); gobalt/v1.0.7 (%v; %v); +(https://github.com/lostdusty/gobalt)", runtime.GOOS, runtime.GOARCH, runtime.Compiler, runtime.Version())
2222
client = http.Client{Timeout: 10 * time.Second} //Reuse the HTTP client
2323
)
2424

@@ -67,7 +67,7 @@ type Settings struct {
6767
AudioCodec audioCodec `json:"aFormat"` //MP3, Opus, Ogg or Wav. If not specified will default to best.
6868
FilenamePattern pattern `json:"filenamePattern"` //Classic, Basic, Pretty or Nerdy. Defaults to Pretty
6969
AudioOnly bool `json:"isAudioOnly"` //Removes the video, downloads audio only. Default: false
70-
UseVimeoDash bool `json:"vimeoDash"` //Changes whether streamed file type is preferred for vimeo videos.. Default: false
70+
TikTokH265 bool `json:"tiktokH265"` //Changes whether 1080p h265 [tiktok] videos are preferred or not. Default: false
7171
FullTikTokAudio bool `json:"isTTFullAudio"` //Enables download of original sound used in a tiktok video. Default: false
7272
VideoOnly bool `json:"isAudioMuted"` //Downloads only the video, audio is muted/removed. Default: false
7373
DubbedYoutubeAudio bool `json:"dubLang"` //Pass the User-Language HTTP header to use the dubbed audio of the respective language, must change according to user's preference, default is English (US). Uses ISO 639-1 standard.
@@ -114,6 +114,7 @@ const (
114114
// DubbedYoutubeAudio: false,
115115
// DisableVideoMetadata: false,
116116
// ConvertTwitterGifs: false,
117+
// TikTokH265: false,
117118
// You MUST set an url before calling Run().
118119
func CreateDefaultSettings() Settings {
119120

@@ -147,7 +148,7 @@ func Run(opts Settings) (*CobaltResponse, error) {
147148
AudioCodec: opts.AudioCodec,
148149
FilenamePattern: opts.FilenamePattern,
149150
AudioOnly: opts.AudioOnly,
150-
UseVimeoDash: opts.UseVimeoDash,
151+
TikTokH265: opts.TikTokH265,
151152
FullTikTokAudio: opts.FullTikTokAudio,
152153
VideoOnly: opts.VideoOnly,
153154
DubbedYoutubeAudio: opts.DubbedYoutubeAudio,

gobalt_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gobalt
22

33
import (
44
"net/url"
5+
"regexp"
56
"testing"
67
)
78

@@ -41,3 +42,17 @@ func TestHealthMainInstance(t *testing.T) {
4142
}
4243

4344
}
45+
46+
func BenchmarkRegexUrlParse(b *testing.B) {
47+
a, _ := regexp.MatchString(`[-a-zA-Z0-9@:%_+.~#?&/=]{2,256}\.[a-z]{2,4}\b(/[-a-zA-Z0-9@:%_+.~#?&/=]*)?`, "https://www.youtube.com/watch?v=b3rFbkFjRrA")
48+
if a {
49+
b.Log("regex pass")
50+
}
51+
}
52+
53+
func BenchmarkNetUrlParse(b *testing.B) {
54+
_, err := url.Parse("https://www.youtube.com/watch?v=b3rFbkFjRrA")
55+
if err != nil {
56+
b.Fatalf("error parsing url: %v", err)
57+
}
58+
}

0 commit comments

Comments
 (0)