Home

Awesome

OwnYourGram

OwnYourGram will check for photos posted to your Instagram account and send them to your website via Micropub.

UPDATE: This is very likely a dead project at this point. Instagram has been working hard to prevent any form of automated requests, and I have not yet found a good workaround. It will pretty much immediately fail running it as a centralized service like I have been doing, it's possible you may have some luck with your own installation of it, but even then I am not confident enough to continue putting work into this.

Installation

The best way to avoid the global rate limits that apply to the hosted instance at ownyourgram.com is to run your own copy of OwnYourGram. You can run it on your own server, or even run it on a laptop.

Requirements

Please ensure you have the following installed before configuring OwnYourGram.

Redis is optional, but highly recommended. Using Redis enables OwnYourGram to cache Instagram responses and also enables adapting to Instagram's rate limits. Without it, OwnYourGram will make more requests to Instagram and will be more likely to get rate limited.

Setup

Clone this project into a folder:

git clone https://github.com/aaronpk/OwnYourGram.git

Install the dependencies:

cd OwnYourGram
composer install

Copy the config.template.php file to config.php and fill out the values.

cp lib/config.template.php lib/config.php

Create the database and a database user:

mysql -u root
CREATE DATABASE ownyourgram;
GRANT ALL PRIVILEGES ON ownyourgram.* TO 'ownyourgram'@'127.0.0.1' IDENTIFIED BY 'ownyourgram';
exit

Create the tables:

mysql -u ownyourgram -pownyourgram < schema/schema.sql

Configure a web server to serve the public folder of this project, or use the built-in PHP server.

nginx

Ensure you have something like the following in a server block for OwnYourGram, and that nginx is configured to handle PHP files.

...
  root /web/OwnYourGram/public;

  try_files $uri /index.php?$args;
...

built-in server

cd public
php -S 127.0.0.1:8080 router.php

Now you can visit the app and log in! The first time you log in it will prompt you to connect an Instagram account.

Polling Tiers

Configure a cron task to run every minute. Rate limiting is checked in the cron job. You'll need to enable this cron job to have OwnYourGram keep your photos up to date automatically. If you only want to manually import from the web interface then you don't need this.

* * * * * /usr/bin/php /web/sites/ownyourgram.com/scripts/ownyourgram-cron.php

Credits

Camera icon by Gracelle Mesina from thenounproject.com https://thenounproject.com/term/camera/62851

License

Copyright 2013-2019 by Aaron Parecki

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.