From: josuer08 Date: Wed, 24 Aug 2022 20:25:26 +0000 (-0400) Subject: added gif X-Git-Tag: linux~2 X-Git-Url: https://git.josue.xyz/?p=hotformathCLI%2F.git;a=commitdiff_plain;h=99bb072073cf514bcc21a8837ba735ec87c438d3 added gif --- diff --git a/README.md b/README.md index 74123f2..8a7dcad 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,16 @@ For instalation you just need to download and run the most recent release direct `go build hotformathCLI.go` should be enough # How does this work? + +## How to use? +![usage](./working.gif) +> Now you can do with those result whatever you please + +In this case on the third link you cna find a very interesting gif of andromeda, as promised. +you can check in there to see what else there is. +https://www.hep.ucl.ac.uk/~clarke/ParticlePhysicsMaterial/ + +## What is inside? This project uses [rocketlaunchr's google-search module](github.com/rocketlaunchr/google-search) to search google for a term introduced by the user and then scraps the first 3 results the query sent to google shoul look a little something like `intext:"[YOUR SEARCH TERM]" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(index_of|listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis) intitle:"index.of./" [specific modifier]` where the specific modifier depends on the flag you use diff --git a/hotformathCLI b/hotformathCLI new file mode 100755 index 0000000..8281534 Binary files /dev/null and b/hotformathCLI differ diff --git a/hotformathCLI.go b/hotformathCLI.go new file mode 100644 index 0000000..e0d9a09 --- /dev/null +++ b/hotformathCLI.go @@ -0,0 +1,68 @@ +package main + +import ( + "context" + "fmt" + "os" + + "github.com/rocketlaunchr/google-search" +) + +func main() { + ctx := context.Background() + opts := googlesearch.SearchOptions{ + Limit: 3, + CountryCode: "us", + LanguageCode: "en", + } + + + + common:=" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(index_of|listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis) intitle:\"index.of./\" " + + VIDEO:=" (avi|mkv|mov|mp4|mpg|wmv)" + AUDIO:=" (ac3|flac|m4a|mp3|ogg|wav|wma)" + EBOOK:=" (CBZ|CBR|CHM|DOC|DOCX|EPUB|MOBI|ODT|PDF|RTF|txt)" + PICTURES:=" (bmp|gif|jpg|png|psd|tif|tiff)" + SOFTWARE:=" (apk|exe|iso|rar|tar|zip)" + COMPRESSED:=" (7z|bz2|gz|iso|rar|zip)" + + // implement getModifier() + + modifier:="" + switch os.Args[1] { + case "-v": + modifier = VIDEO + case "-a": + modifier = AUDIO + case "-e": + modifier = EBOOK + case "-p": + modifier = PICTURES + case "-s": + modifier = SOFTWARE + case "-c": + modifier = COMPRESSED + default: + fmt.Println("Usage: scrapper -[flag] \"[your search]\"") + fmt.Println("flags = [a]udio [c]ompressed [e]book [p]ictures [s]oftware [v]ideo") + os.Exit(0) + } + + query := "intext:\"" + os.Args[2] + "\"" + common + modifier + + + returnLinks, err := googlesearch.Search(ctx, query, opts) + if err != nil { + fmt.Println("Something went wrong: ", err) + return + } + if len(returnLinks) == 0 { + fmt.Println("no results returned: ", returnLinks) + } + + for _, result := range returnLinks { + fmt.Println("*", result.URL) + + } +} diff --git a/scrapper b/scrapper index 1268fdc..290ebc5 100755 Binary files a/scrapper and b/scrapper differ diff --git a/scrapper.go b/scrapper.go deleted file mode 100644 index e0d9a09..0000000 --- a/scrapper.go +++ /dev/null @@ -1,68 +0,0 @@ -package main - -import ( - "context" - "fmt" - "os" - - "github.com/rocketlaunchr/google-search" -) - -func main() { - ctx := context.Background() - opts := googlesearch.SearchOptions{ - Limit: 3, - CountryCode: "us", - LanguageCode: "en", - } - - - - common:=" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(index_of|listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis) intitle:\"index.of./\" " - - VIDEO:=" (avi|mkv|mov|mp4|mpg|wmv)" - AUDIO:=" (ac3|flac|m4a|mp3|ogg|wav|wma)" - EBOOK:=" (CBZ|CBR|CHM|DOC|DOCX|EPUB|MOBI|ODT|PDF|RTF|txt)" - PICTURES:=" (bmp|gif|jpg|png|psd|tif|tiff)" - SOFTWARE:=" (apk|exe|iso|rar|tar|zip)" - COMPRESSED:=" (7z|bz2|gz|iso|rar|zip)" - - // implement getModifier() - - modifier:="" - switch os.Args[1] { - case "-v": - modifier = VIDEO - case "-a": - modifier = AUDIO - case "-e": - modifier = EBOOK - case "-p": - modifier = PICTURES - case "-s": - modifier = SOFTWARE - case "-c": - modifier = COMPRESSED - default: - fmt.Println("Usage: scrapper -[flag] \"[your search]\"") - fmt.Println("flags = [a]udio [c]ompressed [e]book [p]ictures [s]oftware [v]ideo") - os.Exit(0) - } - - query := "intext:\"" + os.Args[2] + "\"" + common + modifier - - - returnLinks, err := googlesearch.Search(ctx, query, opts) - if err != nil { - fmt.Println("Something went wrong: ", err) - return - } - if len(returnLinks) == 0 { - fmt.Println("no results returned: ", returnLinks) - } - - for _, result := range returnLinks { - fmt.Println("*", result.URL) - - } -} diff --git a/working.gif b/working.gif new file mode 100644 index 0000000..cfc8a98 Binary files /dev/null and b/working.gif differ