Search AJAX (limited video information): GET https://api.tokyvideo.com/search-ajax?q=someQuery&wr=false&lang=en_US
Search: POST https://api.tokyvideo.com/search-videos (json body: {"term":"someQuery"})
Get Video (using internal numeral id): GET https://api.tokyvideo.com/video/VIDEOID
To retrieve the numeral id from the path (https://www.tokyvideo.com/video/video-path), find the first script with type=application/ld+json, as it contains a bunch of json info
golang example:
type videoObject struct {
Description string `json:"description"`
EmbedUrl string `json:"embedUrl"`
}
func (a api) Video(id string) (source.Video, error) {
res, err := http.Get("https://tokyvideo.com/video/" + id)
if err != nil {
return source.Video{}, err
}
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return source.Video{}, err
}
s := doc.Find(`script[type="application/ld+json"]`).First().Text()
var videoObj []videoObject
if err := json.Unmarshal([]byte(s), &videoObj); err != nil {
return source.Video{}, err
}
internalVideoId := videoObj[0].EmbedUrl[strings.LastIndex(videoObj[0].EmbedUrl, "/")+1:]
description := videoObj[0].Description
v, err := a.VideoByInternalId(internalVideoId)
v.Description = description
return v, err
}