This commit is contained in:
@@ -30,3 +30,22 @@ func TestIsUsefulGoogleVideoResultRejectsMusicResults(t *testing.T) {
|
||||
t.Fatal("expected bgm/music result to be rejected")
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractVideoObjectJSONLD(t *testing.T) {
|
||||
html := `<script type="application/ld+json">{"@context":"https://schema.org","@type":"VideoObject","name":"Smiling Man and Woman Waving at Camera","description":"Close up shot of a smiling couple waving.","thumbnailUrl":"https://elements-resized.envatousercontent.com/example/video_preview/video_preview_0001.jpg","contentUrl":"https://video-previews.elements.envatousercontent.com/example/watermarked_preview/watermarked_preview.mp4"}</script>`
|
||||
meta := extractVideoObjectJSONLD(html)
|
||||
if meta.Name != "Smiling Man and Woman Waving at Camera" {
|
||||
t.Fatalf("unexpected name: %#v", meta)
|
||||
}
|
||||
if meta.ContentURL == "" || meta.ThumbnailURL == "" || meta.Description == "" {
|
||||
t.Fatalf("expected full video object metadata, got %#v", meta)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanArtgridTitle(t *testing.T) {
|
||||
got := cleanArtgridTitle("movie film moving slowly from a reel by Arthur Cauty | Royalty Free Stock Footage – Artgrid.io")
|
||||
want := "movie film moving slowly from a reel"
|
||||
if got != want {
|
||||
t.Fatalf("expected %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user