first chunk
[hotformathCLI/.git] / scrapper.go
1 package main
2
3 import (
4     "context"
5     "fmt"
6     "github.com/rocketlaunchr/google-search"
7 )
8
9 func main() {
10     ctx := context.Background()
11     opts := googlesearch.SearchOptions{
12     Limit: 3,
13     CountryCode: "us",
14     LanguageCode: "en",
15     }
16     q:="Mr Robot"
17     common:=" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(index_of|listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis) intitle:\"index.of./\" "
18     returnLinks, err := googlesearch.Search(ctx, q, opts)
19     if err != nil {
20         fmt.Println("Something went wrong: ", err)
21     return
22     }
23     if len(returnLinks) == 0 {
24         fmt.Println("no results returned: ", returnLinks)
25     }
26
27     for _, result := range returnLinks {
28         fmt.Println("*", result.URL)
29
30     }
31     //fmt.Println(googlesearch.Search(ctx, "cars for sale in Toronto, Canada"))
32 }