Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package lux for openSUSE:Factory checked in at 2024-02-21 17:58:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lux (Old) and /work/SRC/openSUSE:Factory/.lux.new.1706 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lux" Wed Feb 21 17:58:01 2024 rev:3 rq:1148404 version:0.23.0 Changes: -------- --- /work/SRC/openSUSE:Factory/lux/lux.changes 2023-11-06 21:14:32.039829308 +0100 +++ /work/SRC/openSUSE:Factory/.lux.new.1706/lux.changes 2024-02-21 17:58:02.330823453 +0100 @@ -1,0 +2,14 @@ +Wed Feb 21 06:43:31 UTC 2024 - Michael Vetter <mvet...@suse.com> + +- Update to 0.23.0: + * Update douyinData types.go #1299 + * Update README.md #1302 + * Add --audio-only flag #1304 + * Bilibili Festival #1315 + * Solve bilibili download playlist when LUX will skip files + with same names #1316 + * With the -items parameter, the serial number of the video + should be the serial number of the entire collection, not + the first one downloaded. #1317 + +------------------------------------------------------------------- Old: ---- lux-0.22.0.tar.gz New: ---- lux-0.23.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lux.spec ++++++ --- /var/tmp/diff_new_pack.9v4lLD/_old 2024-02-21 17:58:02.882843414 +0100 +++ /var/tmp/diff_new_pack.9v4lLD/_new 2024-02-21 17:58:02.882843414 +0100 @@ -1,7 +1,7 @@ # # spec file for package lux # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: lux -Version: 0.22.0 +Version: 0.23.0 Release: 0 Summary: A video downloader built with Go License: MIT ++++++ lux-0.22.0.tar.gz -> lux-0.23.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lux-0.22.0/README.md new/lux-0.23.0/README.md --- old/lux-0.22.0/README.md 2023-11-06 06:52:44.000000000 +0100 +++ new/lux-0.23.0/README.md 2024-02-21 02:47:42.000000000 +0100 @@ -669,6 +669,7 @@ ## Similar projects +- [youtube](https://github.com/kkdai/youtube) - [youtube-dl](https://github.com/rg3/youtube-dl) - [you-get](https://github.com/soimort/you-get) - [ytdl](https://github.com/rylio/ytdl) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lux-0.22.0/app/app.go new/lux-0.23.0/app/app.go --- old/lux-0.22.0/app/app.go 2023-11-06 06:52:44.000000000 +0100 +++ new/lux-0.23.0/app/app.go 2024-02-21 02:47:42.000000000 +0100 @@ -89,6 +89,11 @@ Aliases: []string{"f"}, Usage: "Select specific stream to download", }, + &cli.BoolFlag{ + Name: "audio-only", + Aliases: []string{"ao"}, + Usage: "Download audio only at best quality", + }, &cli.StringFlag{ Name: "file", Aliases: []string{"F"}, @@ -300,6 +305,7 @@ Silent: c.Bool("silent"), InfoOnly: c.Bool("info"), Stream: c.String("stream-format"), + AudioOnly: c.Bool("audio-only"), Refer: c.String("refer"), OutputPath: c.String("output-path"), OutputName: c.String("output-name"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lux-0.22.0/downloader/downloader.go new/lux-0.23.0/downloader/downloader.go --- old/lux-0.22.0/downloader/downloader.go 2023-11-06 06:52:44.000000000 +0100 +++ new/lux-0.23.0/downloader/downloader.go 2024-02-21 02:47:42.000000000 +0100 @@ -28,6 +28,7 @@ InfoOnly bool Silent bool Stream string + AudioOnly bool Refer string OutputPath string OutputName string @@ -51,6 +52,10 @@ option Options } +const ( + DOWNLOAD_FILE_EXT = ".download" +) + func progressBar(size int64) *pb.ProgressBar { tmpl := `{{counters .}} {{bar . "[" "=" ">" "-" "]"}} {{speed .}} {{percent . | green}} {{rtime .}}` return pb.New64(size). @@ -134,7 +139,7 @@ return nil } - tempFilePath := filePath + ".download" + tempFilePath := filePath + DOWNLOAD_FILE_EXT tempFileSize, _, err := utils.FileSize(tempFilePath) if err != nil { return err @@ -232,7 +237,7 @@ downloader.bar.Add64(fileSize) return nil } - tmpFilePath := filePath + ".download" + tmpFilePath := filePath + DOWNLOAD_FILE_EXT tmpFileSize, tmpExists, err := utils.FileSize(tmpFilePath) if err != nil { return err @@ -468,7 +473,7 @@ } func mergeMultiPart(filepath string, parts []*FilePartMeta) error { - tempFilePath := filepath + ".download" + tempFilePath := filepath + DOWNLOAD_FILE_EXT tempFile, err := os.OpenFile(tempFilePath, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666) if err != nil { return err @@ -568,6 +573,26 @@ return errors.Errorf("no stream named %s", streamName) } + if downloader.option.AudioOnly { + var isFound bool + reg, err := regexp.Compile("audio+") + if err != nil { + return err + } + + for _, s := range sortedStreams { + // Looking for the best quality + if reg.MatchString(s.Quality) { + isFound = true + stream = data.Streams[s.ID] + break + } + } + if !isFound { + return errors.Errorf("No audio stream found") + } + } + if !downloader.option.Silent { printStreamInfo(data, stream) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lux-0.22.0/extractors/bilibili/bilibili.go new/lux-0.23.0/extractors/bilibili/bilibili.go --- old/lux-0.22.0/extractors/bilibili/bilibili.go 2023-11-06 06:52:44.000000000 +0100 +++ new/lux-0.23.0/extractors/bilibili/bilibili.go 2024-02-21 02:47:42.000000000 +0100 @@ -202,6 +202,33 @@ return &data, nil } +func extractFestival(url, html string, extractOption extractors.Options) ([]*extractors.Data, error) { + matches := utils.MatchAll(html, "<\\s*script[^>]*>\\s*window\\.__INITIAL_STATE__=([\\s\\S]*?);\\s?\\(function[\\s\\S]*?<\\/\\s*script\\s*>") + if len(matches) < 1 { + return nil, errors.WithStack(extractors.ErrURLParseFailed) + } + if len(matches[0]) < 2 { + return nil, errors.New("could not find video in page") + } + + var festivalData festival + err := json.Unmarshal([]byte(matches[0][1]), &festivalData) + if err != nil { + return nil, errors.WithStack(err) + } + + options := bilibiliOptions{ + url: url, + html: html, + aid: festivalData.VideoInfo.Aid, + bvid: festivalData.VideoInfo.BVid, + cid: festivalData.VideoInfo.Cid, + page: 0, + } + + return []*extractors.Data{bilibiliDownload(options, extractOption)}, nil +} + func extractNormalVideo(url, html string, extractOption extractors.Options) ([]*extractors.Data, error) { pageData, err := getMultiPageData(html) if err != nil { @@ -270,7 +297,7 @@ aid: u.Aid, bvid: u.BVid, cid: u.Cid, - subtitle: u.Title, + subtitle: fmt.Sprintf("%s P%d", u.Title, index+1), } go func(index int, options bilibiliOptions, extractedData []*extractors.Data) { defer wgp.Done() @@ -333,9 +360,12 @@ if strings.Contains(url, "bangumi") { // handle bangumi return extractBangumi(url, html, option) + } else if strings.Contains(url, "festival") { + return extractFestival(url, html, option) + } else { + // handle normal video + return extractNormalVideo(url, html, option) } - // handle normal video - return extractNormalVideo(url, html, option) } // bilibiliDownload is the download function for a single URL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lux-0.22.0/extractors/bilibili/bilibili_test.go new/lux-0.23.0/extractors/bilibili/bilibili_test.go --- old/lux-0.22.0/extractors/bilibili/bilibili_test.go 2023-11-06 06:52:44.000000000 +0100 +++ new/lux-0.23.0/extractors/bilibili/bilibili_test.go 2024-02-21 02:47:42.000000000 +0100 @@ -66,6 +66,13 @@ Title: "ãåå¹´æ¦ã2000-2009å¹´æå¼ºåè¯éæ²TOP100 P1 100ç±è½¬è§-ç½å¿ç¥¥", }, }, + { + name: "festival test", + args: test.Args{ + URL: "https://www.bilibili.com/festival/lty10th?bvid=BV1dZ4y1Y7bt", + Title: "æ´å¤©ä¾åå¨å¹´å®æ¹æ¼å±ä¼", + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lux-0.22.0/extractors/bilibili/types.go new/lux-0.23.0/extractors/bilibili/types.go --- old/lux-0.22.0/extractors/bilibili/types.go 2023-11-06 06:52:44.000000000 +0100 +++ new/lux-0.23.0/extractors/bilibili/types.go 2024-02-21 02:47:42.000000000 +0100 @@ -143,3 +143,30 @@ Code int `json:"code"` Data bilibiliWebInterfaceData `json:"data"` } + +type festival struct { + VideoSections []struct { + Id int64 `json:"id"` + Title string `json:"title"` + Type int `json:"type"` + } `json:"videoSections"` + Episodes []episode `json:"episodes"` + VideoInfo struct { + Aid int `json:"aid"` + BVid string `json:"bvid"` + Cid int `json:"cid"` + Title string `json:"title"` + Desc string `json:"desc"` + Pages []struct { + Cid int `json:"cid"` + Duration int `json:"duration"` + Page int `json:"page"` + Part string `json:"part"` + Dimension struct { + Width int `json:"width"` + Height int `json:"height"` + Rotate int `json:"rotate"` + } `json:"dimension"` + } `json:"pages"` + } `json:"videoInfo"` +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lux-0.22.0/extractors/douyin/types.go new/lux-0.23.0/extractors/douyin/types.go --- old/lux-0.22.0/extractors/douyin/types.go 2023-11-06 06:52:44.000000000 +0100 +++ new/lux-0.23.0/extractors/douyin/types.go 2024-02-21 02:47:42.000000000 +0100 @@ -395,7 +395,7 @@ ImgXSize int `json:"img_x_size"` ImgYLen int `json:"img_y_len"` ImgYSize int `json:"img_y_size"` - Interval int `json:"interval"` + Interval float64 `json:"interval"` URI string `json:"uri"` } `json:"big_thumbs"` BitRate []struct {