chore: move test-only helpers to test file
This commit is contained in:
@@ -730,17 +730,6 @@ func detectStreamType(sourceURL string) string {
|
|||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
func isLikelyM3U8(data []byte) bool {
|
|
||||||
return bytes.HasPrefix(bytes.TrimSpace(data), []byte("#EXTM3U"))
|
|
||||||
}
|
|
||||||
|
|
||||||
func isLikelyMP4(data []byte) bool {
|
|
||||||
if len(data) < 8 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return string(data[4:8]) == "ftyp"
|
|
||||||
}
|
|
||||||
|
|
||||||
func detectEmbedType(rawURL string) string {
|
func detectEmbedType(rawURL string) string {
|
||||||
lower := strings.ToLower(rawURL)
|
lower := strings.ToLower(rawURL)
|
||||||
embedHosts := []string{"streamwish", "streamsb", "mp4upload", "ok.ru", "gogoplay", "streamlare"}
|
embedHosts := []string{"streamwish", "streamsb", "mp4upload", "ok.ru", "gogoplay", "streamlare"}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package allanime
|
package allanime
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -8,6 +9,17 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func isLikelyM3U8(data []byte) bool {
|
||||||
|
return bytes.HasPrefix(bytes.TrimSpace(data), []byte("#EXTM3U"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func isLikelyMP4(data []byte) bool {
|
||||||
|
if len(data) < 8 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return string(data[4:8]) == "ftyp"
|
||||||
|
}
|
||||||
|
|
||||||
func TestDecodeSourceURL(t *testing.T) {
|
func TestDecodeSourceURL(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user