diff --git a/config/config.go b/config/config.go index 06d4c75b6..4b05c9e10 100644 --- a/config/config.go +++ b/config/config.go @@ -21,5 +21,5 @@ var FakeHeaders = map[string]string{ "Accept-Charset": "UTF-8,*;q=0.5", "Accept-Encoding": "gzip,deflate,sdch", "Accept-Language": "en-US,en;q=0.8", - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0", + "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36", } diff --git a/downloader/downloader.go b/downloader/downloader.go index e44b49ade..238a7a39d 100644 --- a/downloader/downloader.go +++ b/downloader/downloader.go @@ -30,17 +30,21 @@ type VideoData struct { // [URLData: {URL, Size, Ext}, ...] // Some video files have multiple fragments // and support for downloading multiple image files at once - URLs []URLData - Size int64 - Type string + URLs []URLData + Size int64 + Type string + Quality string } func (data VideoData) printInfo() { fmt.Println() - fmt.Println(" Site: ", data.Site) - fmt.Println("Title: ", data.Title) - fmt.Println(" Type: ", data.Type) - fmt.Printf(" Size: %.2f MiB (%d Bytes)\n", float64(data.Size)/(1024*1024), data.Size) + fmt.Println(" Site: ", data.Site) + fmt.Println(" Title: ", data.Title) + fmt.Println(" Type: ", data.Type) + if data.Quality != "" { + fmt.Println("Quality: ", data.Quality) + } + fmt.Printf(" Size: %.2f MiB (%d Bytes)\n", float64(data.Size)/(1024*1024), data.Size) fmt.Println() } diff --git a/extractors/bilibili.go b/extractors/bilibili.go index 59e9028a5..2736ea069 100644 --- a/extractors/bilibili.go +++ b/extractors/bilibili.go @@ -54,6 +54,15 @@ type bangumiData struct { EpList []bangumiEpData `json:"epList"` } +var quality = map[int]string{ + 116: "高清 1080P60", + 74: "高清 720P60", + 80: "高清 1080P", + 64: "高清 720P", + 32: "清晰 480P", + 15: "流畅 360P", +} + func getSign(params string) string { sign := md5.New() sign.Write([]byte(params + secKey)) @@ -186,11 +195,12 @@ func download(url string, bangumi bool) downloader.VideoData { urls, size := genURL(dataDict.DURL) data := downloader.VideoData{ - Site: "哔哩哔哩 bilibili.com", - Title: utils.FileName(title), - URLs: urls, - Type: "video", - Size: size, + Site: "哔哩哔哩 bilibili.com", + Title: utils.FileName(title), + URLs: urls, + Type: "video", + Size: size, + Quality: quality[dataDict.Quality], } data.Download(url) return data