项目作者: Vorkytaka

项目描述 :
Instagram Scraper for Go
高级语言: Go
项目地址: git://github.com/Vorkytaka/instagram-go-scraper.git
创建时间: 2017-04-02T19:21:42Z
项目社区:https://github.com/Vorkytaka/instagram-go-scraper

开源协议:Apache License 2.0

下载


Instagram Go Scraper

GoDoc
Build Status

Instagram Scraper for Golang.

A package that helps you with requesting to Instagram without a key.

Installation:

Install:

  1. $ go get -u github.com/Vorkytaka/instagram-go-scraper/instagram

Import:

  1. import "github.com/Vorkytaka/instagram-go-scraper/instagram"

List of functions:

After import you can use following functions:

  1. // Get account info
  2. account, err := instagram.GetAccountByUsername("username")
  3. // Get media info
  4. media, err := instagram.GetMediaByCode("code")
  5. media, err := instagram.GetMediaByURL("https://instagram.com/p/code")
  6. // Get slice of account media
  7. media, err := instagram.GetAccountMedia("username", limit)
  8. // or slice of all account media
  9. media, err := instagram.GetAllAccountMedia("username")
  10. // Get slice of location last media
  11. media, err := instagram.GetLocationMedia("location_id", limit)
  12. // Get array[9] of location top media
  13. media, err := instagram.GetLocationTopMedia("location_id")
  14. // Get location info
  15. location, err := instagram.GetLocationByID("location_id")
  16. // Get slice of tag last media
  17. media, err := instagram.GetTagMedia("tag", limit)
  18. // Get array[9] of tag top media
  19. media, err := instagram.GetLocationTopMedia("tag")
  20. // Search for users (return slice of Accounts)
  21. users, err := instagram.SearchForUsers("username")

You’ll get err != nil if request return 404 or if there a parsing error.

About media updates:

Media can have one of 3 types:

  • TypeImage
  • TypeVideo
  • TypeCarousel

From v0.2.03 media has MediaList field for collection of media.

If media is carousel, then there will be a list of all media.

If media is image or video, then there will be only one media, but also,
for backward compatibility, media url will be in media.MediaURL field.

Update data:

You can update media by call Update method:

  1. media, err := instagram.GetMediaByCode("code")
  2. err := media.Update()
  3. if err != nil {
  4. // media didn't update
  5. }

Same with account:

  1. account, err := instagram.GetAccountByUsername("username")
  2. err := account.Update()
  3. if err != nil {
  4. }