Esempio n. 1
0
func main() {
	flag.Parse()
	var inputUser string
	if *instaName == "" {
		log.Fatalln("You need to input -n=Name.")
	}
	inputUser = *instaName

	//Get system user folder
	usr, _ := user.Current()
	baseDir := fmt.Sprintf("%v/Pictures/goInstagram", usr.HomeDir)

	//Get User info
	client = instagram.NewClient(nil)
	client.ClientID = ClientID

	var userId string
	searchUsers, _, err := client.Users.Search(inputUser, nil)
	for _, user := range searchUsers {
		if user.Username == inputUser {
			userId = user.ID
		}
	}

	if userId == "" {
		log.Fatalln("Can not address user name: ", inputUser, err)
	}

	userFolderName := fmt.Sprintf("[%s]%s", userId, inputUser)
	fmt.Println("Starting download [", userId, "]", inputUser)
	FindPhotos(userFolderName, inputUser, userId, baseDir)
}
Esempio n. 2
0
func init() {
	iat := os.Getenv("INSTAGRAM_ACCESS_TOKEN")
	if iat == "" {
		log.Fatal("Missing INSTAGRAM_ACCESS_TOKEN environment variable")
	}
	client = instagram.NewClient(nil)
	client.AccessToken = iat
	// TODO switch to InstagramMediaDynamoDB
	db = database.InstagramMediaDB(database.InstagramMediaInMemoryDB{})
}
Esempio n. 3
0
func callInstagram(query string) {
	client := instagram.NewClient(nil)
	media, _, _ := client.Tags.RecentMedia(query, nil)

	index := 0
	for index < len(media) {
		pics[index] = media[index].Images.LowResolution.URL
		index += 1
	}
	return
}
Esempio n. 4
0
func main() {

	client := instagram.NewClient(nil)
	client.ClientID = "8f2c0ad697ea4094beb2b1753b7cde9c"
	// If you have access_token you can supply it
	// client.AccessToken = ""

	media, next, err := client.Media.Popular()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error: %v\n", err)
	}
	for _, m := range media {
		fmt.Printf("ID: %v, Type: %v\n", m.ID, m.Type)
	}
	if next.NextURL != "" {
		fmt.Println("Next URL", next.NextURL)
	}
}
Esempio n. 5
0
func NewInstagram() *Instagram {
	c := instagram.NewClient(nil)
	return &Instagram{
		client: c,
	}
}