From 67492070ada4d0358f91909e57ed66970551204d Mon Sep 17 00:00:00 2001 From: gan-of-culture Date: Mon, 5 Sep 2022 05:21:26 +0200 Subject: [PATCH] [DELETED] zhentube.com: the website has uptime and latency issues which makes it very un-usable --- README.md | 1 - downloader/utils.go | 6 +- extractors/extractors.go | 2 - extractors/zhentube/zhentube.go | 158 --------------------------- extractors/zhentube/zhentube_test.go | 65 ----------- 5 files changed, 3 insertions(+), 229 deletions(-) delete mode 100644 extractors/zhentube/zhentube.go delete mode 100644 extractors/zhentube/zhentube_test.go diff --git a/README.md b/README.md index d1c0946..c895867 100755 --- a/README.md +++ b/README.md @@ -306,7 +306,6 @@ The following links will direct you to adult content. Please keep that in mind! | [uncensoredhentai.xxx (1080p, 720p, 480p, 360p)](https://uncensoredhentai.xxx/) | ? |:heavy_check_mark:| | [v2.hentaihd.net (1080p, 720p, 480p)](https://v2.hentaihd.net) | ? |:heavy_check_mark:| | [yandere.re](https://yande.re/post) | :heavy_check_mark: | ? | -| [zhentube.com (1080p, 720p)](https://zhentube.com) | ? |:heavy_check_mark:| *you need a login for this site. You can supply it via the parameters -un and -up diff --git a/downloader/utils.go b/downloader/utils.go index 2a2fbcd..fd0f1f3 100755 --- a/downloader/utils.go +++ b/downloader/utils.go @@ -70,12 +70,12 @@ func printStream(key string, stream *static.Stream) { } // for HLS streams the size is only approximated - sizeFString := "%.2f MB (%d Bytes)\n" + sizeFString := "%s\n" if stream.Ext != "" && stream.Size > 0 { - sizeFString = "~" + sizeFString + sizeFString = "~ " + sizeFString } fmt.Printf("\n Size: ") - fmt.Printf(sizeFString, float64(stream.Size)/(1_000_000), stream.Size) + fmt.Printf(sizeFString, utils.ByteCountSI(stream.Size)) fmt.Printf(" # download with: ") fmt.Printf("get-sauce -s %s ...\n\n", key) } diff --git a/extractors/extractors.go b/extractors/extractors.go index d9e1feb..e2c1914 100755 --- a/extractors/extractors.go +++ b/extractors/extractors.go @@ -42,7 +42,6 @@ import ( "github.com/gan-of-culture/get-sauce/extractors/thehentaiworld" "github.com/gan-of-culture/get-sauce/extractors/universal" "github.com/gan-of-culture/get-sauce/extractors/vraven" - "github.com/gan-of-culture/get-sauce/extractors/zhentube" "github.com/gan-of-culture/get-sauce/static" ) @@ -106,7 +105,6 @@ func init() { "www.simply-hentai.com": simplyhentai.New(), "thehentaiworld.com": thehentaiworld.New(), "uncensoredhentai.xxx": nhgroupExtractor, - "zhentube.com": zhentube.New(), } } diff --git a/extractors/zhentube/zhentube.go b/extractors/zhentube/zhentube.go deleted file mode 100644 index 8c3bb66..0000000 --- a/extractors/zhentube/zhentube.go +++ /dev/null @@ -1,158 +0,0 @@ -package zhentube - -import ( - "encoding/json" - "regexp" - "strings" - - "github.com/gan-of-culture/get-sauce/request" - "github.com/gan-of-culture/get-sauce/static" - "github.com/gan-of-culture/get-sauce/utils" -) - -type playerData struct { - HostList struct { - Num1 []string `json:"1"` - } `json:"hostList"` - VideoURL string `json:"videoUrl"` - VideoServer string `json:"videoServer"` - VideoDisk interface{} `json:"videoDisk"` - VideoPlayer string `json:"videoPlayer"` - IsJWPlayer8 bool `json:"isJWPlayer8"` - JwPlayerKey string `json:"jwPlayerKey"` - JwPlayerURL string `json:"jwPlayerURL"` - Logo struct { - File string `json:"file"` - Link string `json:"link"` - Position string `json:"position"` - Hide bool `json:"hide"` - } `json:"logo"` - Tracks []interface{} `json:"tracks"` - Captions struct { - FontSize string `json:"fontSize"` - Fontfamily string `json:"fontfamily"` - } `json:"captions"` - DefaultImage string `json:"defaultImage"` - SubtitleManager bool `json:"SubtitleManager"` - Jwplayer8Button1 bool `json:"jwplayer8button1"` - Jwplayer8Quality bool `json:"jwplayer8quality"` - Title string `json:"title"` - Displaytitle bool `json:"displaytitle"` - RememberPosition bool `json:"rememberPosition"` - Advertising struct { - Client string `json:"client"` - Tag string `json:"tag"` - } `json:"advertising"` - VideoData struct { - VideoImage interface{} `json:"videoImage"` - VideoSources []struct { - File string `json:"file"` - Label string `json:"label"` - Type string `json:"type"` - } `json:"videoSources"` - } `json:"videoData"` -} - -const site = "https://zhentube.com/" - -type extractor struct{} - -// New returns a zhentube extractor. -func New() static.Extractor { - return &extractor{} -} - -// Extract data from URL -func (e *extractor) Extract(URL string) ([]*static.Data, error) { - URLs := parseURL(URL) - if len(URLs) == 0 { - return nil, static.ErrURLParseFailed - } - - data := []*static.Data{} - for _, u := range URLs { - d, err := extractData(u) - if err != nil { - return nil, utils.Wrap(err, u) - } - data = append(data, d) - } - - return data, nil -} - -func parseURL(URL string) []string { - reURL := regexp.MustCompile(site + `[^/]+/$`) - if reURL.MatchString(URL) { - return []string{URL} - } - - htmlString, err := request.Get(URL) - if err != nil { - return nil - } - // remove rest of site's html including the sidebar that contains videos we don't Want - htmlString = strings.Split(htmlString, " tt.Want || len(URLs) == 0 { - t.Errorf("Got: %v - Want: %v", len(URLs), tt.Want) - } - }) - } -} - -func TestExtract(t *testing.T) { - tests := []struct { - Name string - Args test.Args - }{ - { - Name: "Single Episode", - Args: test.Args{ - URL: "https://zhentube.com/kyonyuu-erufu-oyako-saimin-episode-2/", - Title: "Kyonyuu Erufu oyako saimin Episode 2", - Quality: "1920x1080", - Size: 341447292, - }, - }, - } - for _, tt := range tests { - t.Run(tt.Name, func(t *testing.T) { - data, err := New().Extract(tt.Args.URL) - test.CheckError(t, err) - test.Check(t, tt.Args, data[0]) - }) - } -}