austenc / statamic-instagram-feed

Embed a public Instagram feed in your Statamic website with this addon
6 stars 0 forks source link

THIS PACKAGE IS NOW UNMAINTAINED

Sorry folks, but this package is painful to maintain, because it's not an official way of connecting to Instagram. Since Instagram is constantly trying to discourage web scraping, it means fixes are often needed to respond to those changes. As of today (04/13/2022), this repository will be marked as deprecated.

A more "official" alternative is https://statamic.com/addons/lbeauvisage/instagram-user-feed-using-API.

If you insist on continuing down the rocky road of Instagram web scraping, see the following package (which always did the heavy lifting of this one, anyway): https://github.com/pgrimaud/instagram-user-feed

Feel free to reach out on Twitter if you want to take ownership of this repo.

Statamic Instagram Feed Statamic 3

📸 Easily embed an instagram feed in your Statamic site 📸

This version of the addon is only for Statamic 3+

This addon adds a fieldtype which gets images from instagram profiles. It uses web scraping under the hood, so beware, if Instagram changes something it may have issues! Generally, it's pretty stable.

For example:

{{ instagram_feed limit="3" }}
    <img src="https://github.com/austenc/statamic-instagram-feed/raw/master/{{ image }}">
{{ /instagram_feed }}

Requirements

Installation

Require the package with composer:

composer require austenc/statamic-instagram-feed

Configuration

It is recommended to create a dummy instagram account without Two Factor Authentication to use with this addon.

For more information, check out the underlying composer package.

You need to configure an Instagram username and password. Optionally, you can include a different profile for the feed to display.

Set the username/password .env file

INSTAGRAM_USERNAME='your-username'
INSTAGRAM_PASSWORD='your-password'
INSTAGRAM_PROFILE='profile-you-want-to-view'

The username and password do not have to match the profile displayed, as long as the account can view the profile.

Usage

After configuring your Instagram username and password, use the {{ instagram_feed }} tag:

{{ instagram_feed }}
    <img src="https://github.com/austenc/statamic-instagram-feed/raw/master/{{ image }}">
{{ /instagram_feed }}

You may also use the limit parameter to restrict the number of recent posts

Post Fields

Each post in the feed contains a number of fields for you to use.

Field Description
id The post's Instagram ID
image The URL of the image
caption The caption of the post
thumb The URL for the post's thumbnail
date The date it was posted
comments The total number of comments on the post
likes The total number of likes on the post
link The full URL to the post
height The image's height
width The image's width

Available Parameters

Option Default Value Description
limit 12 The number of recent posts to pull
profile null The Instagram profile to display

Support

Find a bug? Have a feature request? I'd be happy to help! Open an issue on github or reach out on twitter @austencam and I will get back to you when I can.