From: josuer08 Date: Wed, 10 Aug 2022 03:25:36 +0000 (-0400) Subject: another chunk lol, it is functional already X-Git-Tag: linux~8 X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=775386f06475c47dcdf27655039f820b89e26e37;p=hotformathCLI%2F.git another chunk lol, it is functional already --- diff --git a/go.mod b/go.mod index c1a72c7..08b7a97 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module main go 1.12 require ( - github.com/gocolly/colly/v2 v2.1.0 - github.com/rocketlaunchr/google-search v1.1.4 // indirect - golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 + github.com/gocolly/colly/v2 v2.1.0 // indirect + github.com/pborman/getopt v1.1.0 + github.com/rocketlaunchr/google-search v1.1.4 ) diff --git a/go.sum b/go.sum index dc61cb7..8cb57f6 100644 --- a/go.sum +++ b/go.sum @@ -20,6 +20,7 @@ github.com/antchfx/xpath v1.1.8/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNY github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -48,10 +49,14 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/jawher/mow.cli v1.1.0/go.mod h1:aNaQlc7ozF3vw6IJ2dHjp2ZFiA4ozMIYY6PyuRJwlUg= github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o= github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak= +github.com/pborman/getopt v1.1.0 h1:eJ3aFZroQqq0bWmraivjQNt6Dmm5M0h2JcDW38/Azb0= +github.com/pborman/getopt v1.1.0/go.mod h1:FxXoW1Re00sQG/+KIkuSqRL/LwQgSkv7uyac+STFsbk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rocketlaunchr/google-search v1.1.4 h1:11tA5CoeUjoNnvdyUMGwyuxzihbBRDhoEFXlMmPm0k4= @@ -60,6 +65,7 @@ github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca h1:NugYot0LIVPxT github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/temoto/robotstxt v1.1.1 h1:Gh8RCs8ouX3hRSxxK7B1mO5RFByQ4CmJZDwgom++JaA= github.com/temoto/robotstxt v1.1.1/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo= @@ -102,6 +108,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/menu.js b/menu.js new file mode 100644 index 0000000..85aecce --- /dev/null +++ b/menu.js @@ -0,0 +1,131 @@ +///////////////////////////////////////////////// +// Variables // +///////////////////////////////////////////////// + var button = $('#dropdown-button') + var subMenu = $('#dropdown-menu') + var subMenuItem = $("#dropdown-menu li") + var searchButton = $('#search-button') + var searchBox = $('#search-box') + + +$(window).resize(function(){ + if ($(window).width() <= 750){ + searchButton.text("Search") + searchButton.append(' '); + } else { + searchButton.text("") + searchButton.append(' '); + } +}); + + +///////////////////////////////////////////////// +// Show Menu Toggle // +///////////////////////////////////////////////// +$(function() { + button.click(function() { + subMenu.slideToggle(250, 'easeInOutQuint'); + }); +}); + +///////////////////////////////////////////////// +// Menu Selection // +///////////////////////////////////////////////// +$(function() { + // Check which sub menu item was clicked + subMenuItem.click(function() { + console.log($(this).text() + " clicked"); // Tell me which item was clicked. + button.text($(this).text()); // Copy the text of the selected menu item to the button. + button.append(' '); // Set the icon to match the text. + button.val($(this).text()); // Set the value of the button to that of the text selected. + subMenu.slideToggle(250, 'easeInOutQuint'); // Hide menu after selection is made. + }); +}); + +///////////////////////////////////////////////// +// Controls Enter Key for TextBox // +///////////////////////////////////////////////// +$(document).ready(function() { + $('body').keypress(function(e) { + if (e.which == 13) { + searchButton.trigger('click'); + console.log("search button clicked"); + } + }); +}); + +///////////////////////////////////////////////// +// Generates the search string // +///////////////////////////////////////////////// +$(document).ready(function() { + searchBox.val(""); + searchBox.focus(); + + searchButton.click(function() { + var type = button.val(); // Set the type valriable to the value of the button. + var query = searchBox.val(); // Set the Query variable to the value of the text box. + var arr = new Array(); // Create a new blank array. + var commonToAll = " -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) " + // This string is common to all searches. + "-inurl:(index_of|listen77|mp3raid|mp3toss|mp3drug|index_of|wall" + + "ywashis) intitle:\"index.of./\" "; + if (query[query.length - 1] == ',') { // Check the length of the search term to see if there were + query = query.slice(0, -1) // multiple search terms used, then slice the string at + } // every comma. + arr = query.split(','); + arr.push(','); + switch (type) { // Compare the type that was set earlier with the cases below + case ("Video"): + { + var extensions = " (avi|mkv|mov|mp4|mpg|wmv)"; + break; + } + case ("Audio"): + { + var extensions = " (ac3|flac|m4a|mp3|ogg|wav|wma) "; + break; + } + case ("Ebook"): + { + var extensions = " (CBZ|CBR|CHM|DOC|DOCX|EPUB|MOBI|ODT|PDF|RTF|txt)"; + break; + } + case ("Pictures"): + { + var extensions = " (bmp|gif|jpg|png|psd|tif|tiff) "; + break; + } + case ("Software/Games"): + { + var extensions = " (apk|exe|iso|rar|tar|zip) "; + break; + } + case ("Compressed"): + { + var extensions = " (7z|bz2|gz|iso|rar|zip) "; + break; + } + default: + { + var extensions = " (avi|mkv|mov|mp4|mpg|wmv)"; + break; + } + } + for (var i = 0; i < arr.length - 1; i++) { + if (arr[i] != "") { + var temp = arr[i]; + var last; + temp = temp.replace(/[^\w\s]/gi, ''); + if (temp != 0) { + last = temp.replace(/ /g, "."); + } + var goodinput = "intext:\"" + last + "\""; + var finalquery = goodinput + extensions + commonToAll; + + var url = "https://www.google.com/search?q=" + encodeURIComponent(finalquery); + //alert(goodinput); + window.open(url, '_blank'); + } + + } + }); +}); diff --git a/scrapper b/scrapper new file mode 100755 index 0000000..1268fdc Binary files /dev/null and b/scrapper differ diff --git a/scrapper.go b/scrapper.go index b24f05d..e0d9a09 100644 --- a/scrapper.go +++ b/scrapper.go @@ -1,9 +1,11 @@ package main import ( - "context" - "fmt" - "github.com/rocketlaunchr/google-search" + "context" + "fmt" + "os" + + "github.com/rocketlaunchr/google-search" ) func main() { @@ -13,9 +15,44 @@ func main() { CountryCode: "us", LanguageCode: "en", } - q:="Mr Robot" + + + common:=" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(index_of|listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis) intitle:\"index.of./\" " - returnLinks, err := googlesearch.Search(ctx, q, opts) + + 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 @@ -28,5 +65,4 @@ func main() { fmt.Println("*", result.URL) } - //fmt.Println(googlesearch.Search(ctx, "cars for sale in Toronto, Canada")) }