-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
64 lines (48 loc) · 1.51 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"flag"
"fmt"
"os"
"time"
"github.com/googlesearch/bing"
"github.com/googlesearch/color"
"github.com/googlesearch/duckduckgo"
"github.com/googlesearch/github"
"github.com/googlesearch/google"
"github.com/googlesearch/stackoverflow"
"github.com/googlesearch/yahoo"
)
func main() {
query := flag.String("q", "", "Please provide the query you want to search")
Engine := flag.String("E", "", "Provide the Search Engine")
countryCode := flag.String("s", "com", "Please provide the country code")
// Domain := flag.String("D", "", "Provide the direct domain")
flag.Parse()
if *query != "" {
fmt.Println()
fmt.Println("-----------------------------------Crawling Started-----------------------------------------")
if *Engine == "google" {
google.GoogleSearch(*query, *countryCode)
} else if *Engine == "duckduckgo" {
duckduckgo.DuckDuckSearch(*query)
} else if *Engine == "bing" {
bing.BingSearch(*query)
} else if *Engine == "yahoo" {
yahoo.YahooSearch(*query)
} else if *Engine == "github" {
github.GithubSearch(*query)
} else if *Engine == "stackoverflow" {
stackoverflow.StackOverflowSearch(*query)
stackoverflow.ProfileResults()
} else {
fmt.Println("Provide the Query")
os.Exit(2)
}
fmt.Println("-----------------------------------Crawling Finished-----------------------------------------")
fmt.Println()
time.Sleep(time.Second * 10)
} else {
fmt.Println(color.Warn("Provide the Name of Search Engine you want's to use"))
os.Exit(1)
}
}