• This repository has been archived on 02/Jan/2021
  • Stars
    star
    556
  • Rank 80,098 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 13 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Instagram jQuery plugin

jQuery Instagram

Select and show a list of Instagram photos.

Getting Started

Download the production version or the development version.

In your web page:

<div class="instagram"></div>

<script src="jquery.js"></script>
<script src="dist/instagram.min.js"></script>
<script>
jQuery(function($) {
  $('.instagram').on('willLoadInstagram', function(event, options) {
    console.log(options);
  });
  $('.instagram').on('didLoadInstagram', function(event, response) {
    console.log(response);
  });
  $('.instagram').instagram({
    hash: 'love',
    clientId: 'YOUR-CLIENT-ID-HERE'
  });
});
</script>

CDN

Production version: //cdnjs.cloudflare.com/ajax/libs/jquery-instagram/0.3.1/instagram.min.js

Development version: //cdnjs.cloudflare.com/ajax/libs/jquery-instagram/0.3.1/instagram.js

Note: please don't use RawGit as a CDN, see The naughtiness score for more info about this issue.

For Rails developers

You can use "instagramjs-rails" gem by bodrovis (https://github.com/bodrovis/instagramjs-rails) to easily add Instagram.js to your projects.

Add this line to your application's Gemfile:

gem 'instagramjs-rails'

And then execute:

$ bundle

In your application.js you will need to add this line:

//= require jquery.instagram

Documentation

Authentication

You can obtain a client id registering a new Instagram API client app at http://instagram.com/developer/clients/register/

Options

hash

Get a list of recently tagged media.

See http://instagram.com/developer/endpoints/tags/#get_tags_media_recent

Authentication: clientId required

Type: String

Default: null

userId

Get the most recent media published by a user.

See http://instagram.com/developer/endpoints/users/#get_users_media_recent

Authentication: accessToken required.

Type: Number

Default: null

location

Get a list of recent media objects from a given location.

See http://instagram.com/developer/endpoints/locations/#get_locations_media_recent

Authentication: clientId required.

Type: Object

Default: null

Parameters:

  • id Location id (required).
  • min_timestamp Return media after this UNIX timestamp.
  • max_timestamp Return media before this UNIX timestamp.
  • min_id Return media before this min_id.
  • max_id Return media after this max_id.

search

Search for media in a given area.

See http://instagram.com/developer/endpoints/media/#get_media_search

Authentication: clientId required.

Type: Object

Default: null

Parameters:

  • lat Latitude of the center search coordinate. If used, lng is required.
  • lng Longitude of the center search coordinate. If used, lat is required.
  • min_timestamp A unix timestamp. All media returned will be taken later than this timestamp.
  • max_timestamp A unix timestamp. All media returned will be taken earlier than this timestamp.
  • distance Default is 1km (distance = 1000), max distance is 5km.

accessToken

OAuth 2 access token.

See http://instagram.com/developer/auth/

Type: String

Default: null

clientId

OAuth 2 client application id.

See http://instagram.com/developer/auth/

Type: String

Default: null

count

Number of photos.

See http://instagram.com/developer/endpoints/#pagination

Type: Number

Default: null

Note: Instagram is filtering out private users' photos at read-time, so you won't always get the full number of photos in the count, see also #14 and https://groups.google.com/d/msg/instagram-api-developers/nKik4i8OYhw/ENu79JbcBAEJ

Note: pagination doesn't work for requests to /media/search, see #35.

url

You can populate this with the next URL object (pagination.next_url) returned by the Instagram API.

Type: String

Default: null

Events

willLoadInstagram

Triggered just before making the request to instagram API.

Params:

  • event
  • options

didLoadInstagram

Called after the response from instagram API.

Params:

  • event
  • response

Examples

Get a list of what media is most popular at the moment

See http://instagram.com/developer/endpoints/media/#get_media_popular

$('.instagram').instagram({
  clientId: 'YOUR-CLIENT-ID-HERE'
});

Get a list of recently tagged media

See http://instagram.com/developer/endpoints/tags/#get_tags_media_recent

$('.instagram').instagram({
  hash: 'love',
  clientId: 'YOUR-CLIENT-ID-HERE'
});

Get the most recent media published by a user

See http://instagram.com/developer/endpoints/users/#get_users_media_recent

$('.instagram').instagram({
  userId: 1574083,
  accessToken: 'YOUR-ACCESS-TOKEN-HERE'
});

Note: this API endpoint needs access token authentication.

Get a list of recent media objects from a given location

See http://instagram.com/developer/endpoints/locations/#get_locations_media_recent

$('.instagram').instagram({
  location: {
    id: 514276
  },
  clientId: 'YOUR-CLIENT-ID-HERE'
});

Search for media in a given area

See http://instagram.com/developer/endpoints/media/#get_media_search

$('.instagram').instagram({
  search: {
    lat: 48.858844,
    lng: 2.294351,
    distance: 2000
  },
  clientId: 'YOUR-CLIENT-ID-HERE'
});

Release History

0.3.1

Add options default values, see #52.

0.3.0

Plugin redesing.

More Repositories

1

gist-txt

A minimal text adventure engine
JavaScript
69
star
2

artii-api

ASCII art API
Ruby
61
star
3

haskell-player

A terminal music player based on afplay
Haskell
38
star
4

gif-codec

GIF encoder/decoder
JavaScript
18
star
5

sinatra_photo_booth

Sinatra Photo Booth is a simple open source application to save webcam snapshots using actionscript and sinatra.
ActionScript
13
star
6

drawbang

Draw 16 x 16 animated pictures. Draw! is a social flavored online pixel art editor.
Ruby
13
star
7

screencapture

A simple script to make time-lapse videos from screencapture images
Shell
10
star
8

jquery-pixel

Moved to
JavaScript
9
star
9

cuorizini

An apparently useless project
JavaScript
9
star
10

sox_mix

Command line mixer using sox
Ruby
5
star
11

thounds

Thounds public API Ruby library
Ruby
5
star
12

potomak.github.com

My github public page
4
star
13

androiddiy

Android clone of WarioWare D.I.Y. game
Java
4
star
14

thoundsmap

A thounds map
JavaScript
4
star
15

countdowntimerapp

A count down timer application
JavaScript
3
star
16

omniauth-stereomood

Ruby
3
star
17

vendetta

ActionScript
2
star
18

scotty-format

Response format helper for the Scotty web framework
Haskell
2
star
19

gitup

GitHub issues upvoting
2
star
20

jquery-pixel-app

Moved to
1
star
21

legion-cache

A legion-based in-memory key value store. Primarly meant to drive development of the legion package.
Haskell
1
star
22

jquery-github

A jQuery plugin to access GitHub API.
JavaScript
1
star
23

useless-app

A useless app
HTML
1
star
24

sprice.github.com

1
star
25

smoodit_storming_peezha_slides

Smood it @ Storming peez'ha
JavaScript
1
star
26

forrst_click

A sample html demo reproducing the Forrst cool click effect
1
star
27

iwilliwont_storming_peezha_slides

I Will I Won't slideshow for the Storming peez'ha
1
star
28

winning

JavaScript
1
star
29

skeleton

A rails application skeleton
Ruby
1
star
30

gridmagazine-js-tool

A tool to help generating GridMagazine configuration file
JavaScript
1
star
31

programmersinpadua.it

JavaScript
1
star
32

chasing-fastweb

Side scroller made with Love2D
Lua
1
star
33

non-square-pixel

1
star
34

Maxim

A Max7219 interface used by OTOH
C++
1
star
35

smoodit

Smood it API Ruby library
Ruby
1
star
36

smoodit-example

Example app built using the Smood it Ruby gem
Ruby
1
star