Fetch instagram photos without the need for app aproval

Overview

Kirby3 Instagram feed

Fetch instagram photos without the need for app aproval. This plugin will download the photos and/or video thumbnails to local storage. All media will be stored in a json file.

Only the 20 latest photo's will be stored.

This plugin uses the basic user access token which you can generate for all testusers of your instagram app. (https://developers.facebook.com/docs/instagram-basic-display-api/overview#user-token-generator)

Options

Required are the client_id (Instagram App ID) and client_secret (Instagram App Secret). All other options are optional.

# site/config/config.php
return [
    'genxbe.instagram' => [
        'client_id' => '',
        'client_secret' => '',
        'assetFolder' => 'instagram',
        'mediaFolder' => 'media',
        'db' => 'instagram.json',
    ],
];

Usage

  • find a place to add the instagramLink blueprint

  • Add your client_id and client_secret to your config file, all other options are optional.

  • Don't forget to add your website redirect uri to the Valid OAuth Redirect URIs

    • You can add multiple website and thus use 1 app for all of your websites

    • Format of the url you need to add is https://yoursite.com/axi/instagram

  • Add the instagram account you want to use to the test users and ask them to accept the invite (instructions below)

  • Ask your user to enable the instagram link on the website, when this process is completed a first time fetch will already be done.

  • After the user has linked his Instagram you can start fetching via php site/plugins/kirby3-instagram/fetch.php

  • If you want to have regular updates you need to schedule this command via the cron. I would advise to do this every 30 or 60 minutes so you don't overload your API rate limit. (More info on https://developers.facebook.com/docs/graph-api/overview/rate-limiting/#platform-rate-limits)

Examples

Add linkInstagram to blueprint

title: Site
preset: pages
unlisted: true

fields:
  linkInstagram: linkInstagram

After the first fetch you can start parsing the feed

You can check for a count of the feed to hide the block when no media is available yet. Since we work with collections you can also use fieldMethods like limit, filterBy, etc...

" target="_blank"> limit(5) as $media): ?> ">

$page->title() ?>h1> if(count(instagramFeed())): ?> foreach(instagramFeed() as $media): ?> <a href=" $media['permalink']; ?>" target="_blank"> <img src="assets/instagram/media/ $media['id']; ?>.jpg" width="100" height="100" /> a> endforeach; ?> foreach(instagramFeed()->limit(5) as $media): ?> <a href=" $media['permalink']; ?>" target="_blank"> <img src="assets/instagram/media/ $media['id']; ?>.jpg" width="100" height="100" /> a> endforeach; ?> endif; ?>

Fields that can be used in the $media array based on the example above.

  • $media['id']
  • $media['timestamp']
  • $media['media_type']
  • $media['media_url']
  • $media['caption']
  • $media['permalink']
  • $media['username']
  • $media['thumbnail_url']

Setup cron

Every 30 minutes

*/30 * * * * cd /home/website/website.com/ && php site/plugins/kirby3-instagram/fetch.php

Every hour

0 * * * * cd /home/website/website.com/ && php site/plugins/kirby3-instagram/fetch.php

Faster is possible but do keep your rate limits in mind! (More info on https://developers.facebook.com/docs/graph-api/overview/rate-limiting/#platform-rate-limits)

Plugin installation

Download

Download and copy this repository to /site/plugins/kirby3-instagram.

Git submodule

git submodule add https://github.com/genxbe/kirby3-instagram.git site/plugins/kirby3-instagram

Composer

composer require genxbe/kirby3-instagram

Facebook app configuration

Detailed instructions on: https://elfsight.com/blog/2016/05/how-to-get-instagram-access-token/ (step 1-2)

  • Create a Facebook app
  • Setup Instagram Basic display
    • Important, your website OAuth url must be added as a valid OAuth redirect URI!
    • All other url's (deauthorize & data deletion) don't really matter, you can enter your own website there.
    • Don't request an app review

Adding test users

Detailed instructions on: https://elfsight.com/blog/2016/05/how-to-get-instagram-access-token/ (step 3)

Authenticate the instagram user and request User token

Follow instructions on https://www.notion.so/genxbe/Link-instagram-with-your-website-9aa72c4961074cb4b4f9b5d1e6322e36

Usage on multiple websites

You can use your 1 app for multiple sites by adding multiple OAuth redirect URI, please do keep your rate limit in mind. You can always create multiple facebook apps do divide the rate limit.

License

MIT

Credits

Comments
  • instagramLink blueprint

    instagramLink blueprint

    Hoping you can help me through some setup of this plugin (which I greatly appreciate you taking the time to build). With so many hoops to jump though I'd like to confirm a few things...

    Your instructions state, "find a place to add the instagramLink blueprint". What does that mean? Is this just referring to me adding "linkInstagram" to one of my page blueprints. For example, I want to feature a Instagram feed on my home page so I'll add this to my home.yml file. Please confirm.

    opened by thewebprojects 13
  • Error following authentication

    Error following authentication

    Hi, I think everything is working correctly with the plugin, I have done a test fetch which worked. However, when the authentication triggered in Kirby's panel was completed I got the following error:

    Whoops\Exception\ErrorException thrown with message "Cms\Site::panelUrl() has been deprecated and will be removed in Kirby 3.8.0. Use $site->panel()->url() instead."
    
    Stacktrace:
    #9 Whoops\Exception\ErrorException in /home/***/dev/kirby/src/Cms/Helpers.php:29
    #8 trigger_error in /home/***/dev/kirby/src/Cms/Helpers.php:29
    #7 Kirby\Cms\Helpers:deprecated in /home/***/dev/kirby/src/Cms/Site.php:696
    #6 Kirby\Cms\Site:panelUrl in /home/***/dev/site/plugins/kirby3-instagram/classes/Instagram.php:86
    #5 X\Instagram:getToken in /home/***/dev/site/plugins/kirby3-instagram/index.php:21
    #4 Kirby\Http\Route:{closure} in [internal]:0
    #3 Closure:call in /home/***/dev/kirby/src/Http/Router.php:131
    #2 Kirby\Http\Router:call in /home/***/dev/kirby/src/Cms/App.php:337
    #1 Kirby\Cms\App:call in /home/***/dev/kirby/src/Cms/App.php:1256
    #0 Kirby\Cms\App:render in /home/***/dev/index.php:5
    

    I am running Kirby 3.7.1

    bug 
    opened by MikeHarrison 3
  • Instagram token missing?

    Instagram token missing?

    I have been using this plugin including a cronjob for several months without any issues but since Wednesday I received this error message from the cronjob:

    Exception: There's a problem accessing Instagram. (API access disrupted. Go to the App Dashboard and complete Data Use Checkup.) in file /var/www/virtual/peleke7/peleke.de/site/plugins/kirby3-instagram/classes/Instagram.php on line 144 Stack trace:

    1. Exception->() /var/www/virtual/peleke7/peleke.de/site/plugins/kirby3-instagram/classes/Instagram.php:144
    2. X\Instagram->fetch() /var/www/virtual/peleke7/peleke.de/site/plugins/kirby3-instagram/fetch.php:27

    I then clicked on the panel link to recreate the link and allowed access as months before, also without any issues. But when the next cronjob got triggered I received this error message:

    Exception: Instagram token is required. in file /var/www/virtual/peleke7/peleke.de/site/plugins/kirby3-instagram/fetch.php on line 24 Stack trace:

    1. Exception->() /var/www/virtual/peleke7/peleke.de/site/plugins/kirby3-instagram/fetch.php:24

    How could I debug/fix it? Maybe related to #7?

    opened by MaluNoPeleke 2
  • Error message on running cron job

    Error message on running cron job

    Hi,

    Sorry me again!

    I am getting the following error when running the cron job to fetch the instagram posts:

    Whoops\Exception\ErrorException: unlink(/home/xxxxxx/public_html/assets/instagram/media17860440146772998.jpg): No such file or directory in file /home/xxxxxx/public_html/site/plugins/kirby3-instagram/classes/Instagram.php on line 188
    Stack trace:
    1. Whoops\Exception\ErrorException->() /home/xxxxxx/public_html/site/plugins/kirby3-instagram/classes/Instagram.php:188
    2. unlink() /home/xxxxxx/public_html/site/plugins/kirby3-instagram/classes/Instagram.php:188
    3. X\Instagram->fetch() /home/xxxxxx/public_html/site/plugins/kirby3-instagram/fetch.php:27
    

    It looks like there is a slash missing on the url between media and the filename. Oddly I didn't have this issue when running the site locally, it is only cropping up on the live site.

    If you have any thoughts, or ideas of things to try, that would be great. Thanks!

    bug 
    opened by MikeHarrison 2
  • Can't access Notion page

    Can't access Notion page

    Hello and thank you for taking the time to build this Instagram plugin for Kirby. I'm trying to get this up and running. There are lots of hoops to jump though. Your instructions (under 'Authenticate the instagram user and request User token') provides a link to a Notion page, but I cannot access it. I get a message that states, "You do not have access to GeNx. Please contact an admin to add you as a member." Please advise.

    documentation 
    opened by thewebprojects 2
  • No fields yet

    No fields yet

    I have just installed and followed your plugin instructions but in the blueprint field I see only the message "No fields yet". I am using Kirby 3.6.0 alpha. Could that be the problem?

    opened by MaluNoPeleke 2
  • Instagram credentials are not stored in site.txt on server

    Instagram credentials are not stored in site.txt on server

    When tested on local everything seems to work perfectly. However, when placed on a testing server, the Instagram credentials are not saved in the site.txt file, only the refreshed date:

    Instagramauth: 
    
    ----
    
    Instagramtoken: 
    
    ----
    
    Instagramtokenrefreshed: 2022-08-08
    

    The test server is running the same 3.7.0.1 Kirby instance and is running on PHP 8.1. Any idea why this is not working?

    bug 
    opened by lmgringhuis 4
Releases(1.0.9)
Owner
GeNx
GeNx
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.

Lychee Organisation 2.3k Jan 1, 2023
Alternative image provider for fakerphp using picsum.photos

Fakerphp Picsum Images Introduction Alternative image provider for fakerphp using picsum.photos This package has been forked from mmo/faker-images for

Arnaud Becher 16 Dec 9, 2022
Manage your photos with Piwigo, a full featured open source photo gallery application for the web

Manage your photos with Piwigo, a full featured open source photo gallery application for the web. Star us on Github! More than 200 plugins and themes available. Join us and contribute!

Piwigo 1.8k Apr 14, 2022
Laragram is a simple instagram "clone" built with Laravel and Tailwind CSS

Laragram is a simple instagram "clone" built with Laravel and Tailwind CSS that gives to the users the ability to create or edit their own profiles (including profile image and description), upload images and share them among friends

null 0 Jul 24, 2021
Instagram with ImageMagick & PHP

Instagraph - Instagram with ImageMagick & PHP In this repository, I’ll demonstrate you how to create vintage (just like Instagram does) photos effects

Dejan Marjanovic 326 Nov 3, 2022
:racehorse: find the size of an image without downloading the whole file. Supports batch requests.

FasterImage FasterImage finds the dimensions or filetype of a remote image file given its uri by fetching as little as needed, based on the excellent

Will Washburn 58 Nov 30, 2022
The image server plugin allows you to add responsive images via config without extra elements

Grav image server plugin adds picture tag with loading, responsive, high density images

catchIT 7 Dec 30, 2022
Plugin for Craft CMS that makes it easy to interact with the Instagram Basic Display API and Instagram oEmbed.

Instagram Basic Display plugin for Craft CMS 3.x This plugin creates endpoints in your Craft install for you to consume the Instagram Basic Display AP

Jonathan Melville 5 Dec 20, 2022
Oui instagram - Instagram user infos and recent images embedding plugin for @textpattern

oui_instagram Easily display Instagram recent images galleries. Plugin requirements required: Textpattern CMS 4.6+. recommended: aks_cache or any part

Nicolas Morand 4 Feb 20, 2020
Here is an Instagram Guest API. Gather all public information as JSON format without logging yourself.

Here is an Instagram Guest API. Gather all public information as JSON format without logging yourself. It's all automation and time saving.

Quatrecentquatre 1 Nov 2, 2021
Instagram automation represents the use of third-party software to manage your account, carry out tasks and/or interact with users without a human present. Bulit in Laravel Framework

How to Deploy laravel project to heroku Video Link : https://youtu.be/7Nq_a2QiaHo Home Page Login Page Dashboard Page About Laravel Laravel is a web a

null 1 Dec 3, 2021
A simple PHP MVC framework without extra files and codes that you don't need

Welcome to (SPM) Simple PHP MVC, just what you need! This is a simple PHP MVC framework without extra files and codes that you don't need.

Van Hudson Galvoso 5 Sep 17, 2022
Stateless HTTP basic auth for Laravel without the need for a database.

Laravel Very Basic Auth Documentation available in: ???? English ???? 日本語 This package allows you to add a HTTP Basic Auth filter on your routes, with

Marcus Olsson 141 Dec 31, 2022
Simple papara payment api that you can use without the need for an activation key

PaparaQrApi Papara QR Api Simple papara payment api that you can use without the need for an activation key. Explore the docs » View Demo About The Pr

Azad 6 Dec 20, 2022
Web app to share your favorite photos, made with laravel

Kuro Photos Web app to share your favorite photos, made with laravel. This web app was made for educationals purposes only. I enjoyed so much learning

Julian Salcedo Torres 4 Dec 29, 2022
A simple Lumen web app to send basic commands and fetch the current status to your Ford vehicle with Sync 3 enabled

FordPass Access This is a simple Lumen web app to send basic commands and fetch the current status to your Ford vehicle with Sync 3 enabled. Local dev

Sam 4 Nov 21, 2022
Instagram Clone App made with Laravel a PHP Framework

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

null 0 Jun 29, 2022
Ray server is a beautiful, lightweight php app build on Laravel that helps you debug your app. It runs without installation on multiple platforms.

RayServer is a beautiful, lightweight web server built on Laravel and VueJs that helps debugging your app. It runs without installation on multiple platforms.

Pavel Buchnev 310 Jan 2, 2023
salah eddine bendyab 18 Aug 17, 2021
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.

Lychee A great looking and easy-to-use photo-management-system. Since the 1st of April 2018 this project has moved to it's own Organisation (https://g

Tobias Reich 6.2k Jan 5, 2023