Skip to content

Commit

Permalink
[extractor:hstream] updated extractor for dynamic stream domains and …
Browse files Browse the repository at this point in the history
…updated tests
  • Loading branch information
gan-of-culture committed Sep 19, 2023
1 parent 1b700a7 commit 09b6a5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions extractors/hstream/hstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,21 @@ import (

const site = "https://hstream.moe/"
const api = "https://hstream.moe/player/api"
const fileProvider = "https://str.h-dl.xyz"

type APIResponse struct {
Title string `json:"title"`
Poster string `json:"poster"`
Legacy int `json:"legacy"`
Resolution string `json:"resolution"`
StreamURL string `json:"stream_url"`
Title string `json:"title"`
Poster string `json:"poster"`
Legacy int `json:"legacy"`
Resolution string `json:"resolution"`
StreamURL string `json:"stream_url"`
StreamDomains []string `json:"stream_domains"`
}

type APIPayload struct {
EpisodeID string `json:"episode_id"`
}

var reEpisodeID = regexp.MustCompile(`e_id" type="hidden" value="([^"]*)`)
var reCaptionSource = regexp.MustCompile(`https://.+/\d+/[\w.]+/[\w./]+\.ass`)

type extractor struct{}

Expand Down Expand Up @@ -146,7 +145,7 @@ func extractData(URL string) (*static.Data, error) {
return nil, err
}

videoSourceBaseURL := fmt.Sprintf("%s/%s", fileProvider, res.StreamURL)
videoSourceBaseURL := fmt.Sprintf("%s/%s", res.StreamDomains[0], res.StreamURL)
videoSources := []string{
videoSourceBaseURL + "/x264.720p.mp4",
}
Expand Down
4 changes: 2 additions & 2 deletions extractors/hstream/hstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func TestExtract(t *testing.T) {
Args: test.Args{
URL: "https://hstream.moe/hentai/maki-chan-to-now/1",
Title: "Maki-chan to Now. - 1",
Quality: "av1.1080p.webm",
Size: 180211896,
Quality: "3840x2160",
Size: 0,
},
},
}
Expand Down

0 comments on commit 09b6a5a

Please sign in to comment.