-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (41 loc) · 817 Bytes
/
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
package main
import (
"bufio"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
"sync"
)
var wg sync.WaitGroup
func main(){
file, ferr := os.Open("usernames.txt")
if ferr != nil{
log.Fatal(ferr)
}
// Create a new buffer to read the file into
scanner := bufio.NewScanner(file)
for scanner.Scan(){
usernameText := scanner.Text()
username := strings.ToLower(usernameText)
wg.Add(1)
go checkName(username)
wg.Wait()
}
}
func checkName(name string){
checkName, err := http.Get("https://www.instagram.com/"+name+"/")
if err != nil{
log.Fatal(err)
}
checkPageBytes, err := ioutil.ReadAll(checkName.Body)
checkPageStr := string(checkPageBytes)
if strings.Contains(checkPageStr, "@"+name+""){
fmt.Println(""+name+" Is Taken")
} else{
fmt.Println(""+name+" Is Free")
}
wg.Done()
}