Compare commits

...

5 Commits

Author SHA1 Message Date
github-actions[bot]
f5abaac8b7 Update version to v1.4.91 and commit 2024-11-05 10:25:55 +00:00
Eugen Eisler
0bb4f58222 fix: bufio.Scanner message too long 2024-11-05 11:25:32 +01:00
github-actions[bot]
96c8117135 Update version to v1.4.90 and commit 2024-11-04 12:44:39 +00:00
Eugen Eisler
1830ae2321 feat: impl. Youtube PlayList support 2024-11-04 13:44:20 +01:00
Eugen Eisler
7af94a9d2a fix: close #1103, Update Readme hpt to install to_pdf 2024-11-04 10:54:26 +01:00
6 changed files with 19 additions and 17 deletions

View File

@@ -359,7 +359,7 @@ This will create a PDF file named `output.pdf` in the current directory.
To install `to_pdf`, install it the same way as you install Fabric, just with a different repo name.
```bash
go install github.com/danielmiessler/fabric/to_pdf@latest
go install github.com/danielmiessler/fabric/plugins/tools/to_pdf@latest
```
Make sure you have a LaTeX distribution (like TeX Live or MiKTeX) installed on your system, as `to_pdf` requires `pdflatex` to be available in your system's PATH.

View File

@@ -23,8 +23,6 @@ func Cli(version string) (err error) {
return
}
println("Message: " + currentFlags.Message)
if currentFlags.Version {
fmt.Println(version)
return
@@ -150,7 +148,7 @@ func Cli(version string) (err error) {
var playlistId string
if videoId, playlistId, err = registry.YouTube.GetVideoOrPlaylistId(currentFlags.YouTube); err != nil {
return
} else if videoId == "" && playlistId != "" {
} else if (videoId == "" || currentFlags.YouTubePlaylist) && playlistId != "" {
if currentFlags.Output != "" {
err = registry.YouTube.FetchAndSavePlaylist(playlistId, currentFlags.Output)
} else {

View File

@@ -42,7 +42,8 @@ type Flags struct {
OutputSession bool `long:"output-session" description:"Output the entire session (also a temporary one) to the output file"`
LatestPatterns string `short:"n" long:"latest" description:"Number of latest patterns to list" default:"0"`
ChangeDefaultModel bool `short:"d" long:"changeDefaultModel" description:"Change default model"`
YouTube string `short:"y" long:"youtube" description:"YouTube video \"URL\" to grab transcript, comments from it and send to chat"`
YouTube string `short:"y" long:"youtube" description:"YouTube video or play list \"URL\" to grab transcript, comments from it and send to chat or print it put to the console and store it in the output file"`
YouTubePlaylist bool `long:"playlist" description:"Prefer playlist over video if both ids are present in the URL"`
YouTubeTranscript bool `long:"transcript" description:"Grab transcript from YouTube video and send to chat (it used per default)."`
YouTubeComments bool `long:"comments" description:"Grab comments from YouTube video and send to chat"`
Language string `short:"g" long:"language" description:"Specify the Language Code for the chat, e.g. -g=en -g=zh" default:""`
@@ -94,18 +95,20 @@ func Init() (ret *Flags, err error) {
// readStdin reads from stdin and returns the input as a string or an error
func readStdin() (ret string, err error) {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
ret += scanner.Text() + "\n"
}
if err = scanner.Err(); err != nil {
if errors.Is(err, io.EOF) {
err = nil
} else {
err = fmt.Errorf("error reading piped message from stdin: %w", err)
reader := bufio.NewReader(os.Stdin)
var sb strings.Builder
for {
line, err := reader.ReadString('\n')
if err != nil {
if errors.Is(err, io.EOF) {
sb.WriteString(line)
break
}
return "", fmt.Errorf("error reading piped message from stdin: %w", err)
}
sb.WriteString(line)
}
return
return sb.String(), nil
}
func (o *Flags) BuildChatOptions() (ret *common.ChatOptions) {

View File

@@ -1 +1 @@
"1.4.89"
"1.4.91"

View File

@@ -59,6 +59,7 @@ func (o *YouTube) GetVideoOrPlaylistId(url string) (videoId string, playlistId s
}
// Video ID pattern
//https:((youtu.be/7qZl_5xHoBw
videoPattern := `(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})`
videoRe := regexp.MustCompile(videoPattern)
videoMatch := videoRe.FindStringSubmatch(url)

View File

@@ -1,3 +1,3 @@
package main
var version = "v1.4.89"
var version = "v1.4.91"