Created
October 14, 2020 18:16
-
-
Save pressure679/ed0198ad6adbd66e022747bbd310a7c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"bufio" | |
// "io/ioutil" | |
"os" | |
"flag" | |
"strings" | |
"github.com/ahmdrz/goinsta" | |
) | |
func main() { | |
insta := goinsta.New( | |
"vittusm_pressure679", | |
"Glvimia789", | |
) | |
if err := insta.Login(); err != nil { panic(err) } | |
var tags []string | |
file := flag.String("file", "", "the file with the tags to process") | |
flag.Parse() | |
osFile, err := os.Open("/home/pressure679/Documents/IT-Design/Tkinter/Mit TKinter-program/" + *file) | |
if err != nil { panic(err) } | |
bufioReader := bufio.NewReader(osFile) | |
for { | |
line, _, err := bufioReader.ReadLine() | |
if err != nil { if err.Error() == "EOF" { break } else { panic(err) } } | |
tags = append(tags, string(line)) | |
if len(tags) == 0 { | |
continue | |
} | |
} | |
if err = osFile.Close(); err != nil { panic(err) } | |
// download_folder := flag.String("dlfolder", "", "folder directory path to download to") | |
// flag.Parse() | |
for arghtnum, _ := range tags { | |
fmt.Println("processing", tags[arghtnum]) | |
feedTag, err := insta.Feed.Tags(tags[arghtnum]) | |
if err != nil { panic(err) } | |
for _, item := range feedTag.RankedItems { | |
if _, err := os.Stat("/home/pressure679/Pictures/Manifest/" + tags[arghtnum] + "/images/" + item.ID + ".jpg"); os.IsExist(err) { continue } | |
if _, err := os.Stat("/home/pressure679/Pictures/Manifest/" + tags[arghtnum] + "/videos/" + item.ID + ".mp4"); os.IsExist(err) { continue } | |
// imgname, vidname, err := item.Download("/home/pressure679/Documents/IT-Design/Tkinter/Mit TKinter-program/" + tags[arghtnum], "") | |
_, _, err := item.Download("/home/pressure679/Pictures/Manifest/" + tags[arghtnum], "") | |
if err != nil { | |
if strings.EqualFold(err.Error(), "cannot find any image or video") { continue } | |
panic(err) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment