Coder Social home page Coder Social logo

ownyourgram's Introduction

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
  • $hostname - set to the hostname you've configured to serve this app. Use localhost if using the built-in PHP server.
  • $ssl - true or false depending on whether you access OwnYourGram over https
  • $gaid - If you want to use Google Analytics, set your Google Analytics tracking ID here
  • $newUsersAllowed - true or false - the first time you set this up, ensure it's set to true so that you can log in. If you want to lock down your installation to only existing users, set this to false and no new users will be able to log in.
  • $redis - false or tcp://127.0.0.1:6379 - if you have Redis enabled, the performance of OwnYourGram will be improved
  • $cacheIGRequests - true or false - enable caching for better performance
  • $xray - false or the hostname of an XRay service - Setting this to false will cause OwnYourGram to fetch Instagram pages directly. This is best if you are running this on a laptop. If you're running it on a cloud server, you may want to run an external XRay service in case Instagram is blocking the IP address of your server.
  • $igCookie - false or your Instagram session cookie - setting this to a cookie will cause all requests to Instagram to be made with this cookie. This can be helpful to get around some rate limits, but may put the account at risk of getting flagged as a bot.
  • $db - the configuration for your MySQL database

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
  • 0 - account disabled. will only be re-enabled after the user signs in.
  • 1 - daily
  • 2 - every 6 hours
  • 3 - every hour
  • 4 - every 15 minutes

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.

ownyourgram's People

Contributors

aaronpk avatar deponewd avatar diplix avatar jalcine avatar kylewm avatar lostfocus avatar mrcgrtz avatar ruxton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ownyourgram's Issues

Nothing being posted. Missing authorization endpoint?

Noticed I haven't had anything posting recently from Instagram.

Went to log in to OwnYourGram and got this...
screen shot 2017-12-26 at 11 21 23 am
Use Twitter to verify, then I get this...
screen shot 2017-12-26 at 11 20 40 am

First screen says I have an endpoint, second one says I don't. Am I missing something?

Apart from a plugin issue with the IndieWeb plugin (now fixed) nothing has changed on my Wordpress site.

Issue un-authenticating while moving from one site to another

I was moving my Instagram posting target from a WordPress install to a Known install.

For my WP install, on IG I revoked access from OYG and then reauthenticated for my Known site at http://stream.boffosocko.com. However, I'm still getting micropub posts to the WP install at www.boffosocko.com. (Note that I would like to keep both sites listed in my Instagram profile/bio, if that makes a difference.)

Is there something else I need to do to deactivate ownyourgram from publishing to my WordPress install?

Is it possible that OwnYourGram holds the same authentication for two separate sites using the same Instagram account? This could mean that one would need an "off" switch through the ownyourgram interface to deauthorize one site. It could also separately be the case that Instagram didn't flush a cache which allowed my last IG post to the WP site to slip through.

Add support for syndicate-to

OwnYourGram should poll the micropub endpoint querying for syndication endpoints and present the list to the user. The user should be able to store one or more syndication targets in ownyourgram and have ownyourgram send that parameter along with each micropub endpoint.

ownyourgram won’t send gram to my micropub endpoint …

… unless i press the test button.
ownyour gram show an old response from my micropub endpoint and only after i press test, the gram will be posted to my site. i didn’t check the logs on my side, but may actually nothing changed on my side? maybe i have to renew my instagram permissions?

bildschirmfoto 2015-09-19 um 00 50 19
(before i press test)

bildschirmfoto 2015-09-19 um 00 55 28
(after i press "test")

[error] 2572#0: *13748 FastCGI sent in stderr: "PHP message: Didn't get slug

Hello,

I'm new in the indieweb, I set a Known instance at this address https://kash.space
Then I install the IndiePub plugin and connect my Instagram account to bridgy. Finally I create my account on OwnYourGram. I did the test who was a succes but nothing has been post on my known.

There is the tail of the error log of nginx. To be honest I'm not sure to understand.

Thank you.

2015/06/23 14:53:21 [warn] 2572#0: *13748 a client request body is buffered to a temporary file /etc/nginx/client_body_temp/0000000142, client: 173.230.155.197, server: kash.space, request: "POST /micropub/endpoint HTTP/1.1", host: "kash.space" 2015/06/23 14:53:24 [error] 2572#0: *13748 FastCGI sent in stderr: "PHP message: Didn't get slug PHP message: Setting resilient slug PHP message: Set resilient slug PHP message: Didn't get slug PHP message: Setting resilient slug PHP message: Set resilient slug PHP message: Known (kash.space): INFO - Pinging https://withknown.superfeedr.com/ with data hub.mode=publish&hub.url=https%3A%2F%2Fkash.space%2F,https%3A%2F%2Fkash.space%2F%3F_t%3Drss,https%3A%2F%2Fkash.space%2Fcontent%2Fphotos%2F,https%3A%2F%2Fkash.space%2Fcontent%2Fphotos%2F%3F_t%3Drss,https%3A%2F%2Fkash.space%2Fcontent%2Fall%2F,https%3A%2F%2Fkash.space%2Fcontent%2Fall%2F%3F_t%3Drss,https%3A%2F%2Fkash.space%2Ftag%2F%23ecology,https%3A%2F%2Fkash.space%2Ftag%2F%3F_t%3Drss,https%3A%2F%2Fkash.space%2Ftag%2F%23nature,https%3A%2F%2Fkash.space%2Ftag%2F%3F_t%3Drss,https%3A%2F%2Fkash.space%2Ftag%2F%23bee,https%3A%2F%2Fkash.space%2Ftag%2F%3F_t%3Drss 5" while reading response header from upstream, client: 173.230.155.197, server: kash.space, request: "POST /micropub/endpoint HTTP/1.1", upstream: "fastcgi://unix:/var/www/kash.space/php.sock:", host: "kash.space" 2015/06/23 14:54:16 [warn] 2572#0: *13754 an upstream response is buffered to a temporary file /etc/nginx/fastcgi_temp/3/14/0000000143 while reading upstream, client: 109.128.250.169, server: kash.space, request: "GET /file/dec3880545c2f81966792658ac433569 HTTP/1.1", upstream: "fastcgi://unix:/var/www/kash.space/php.sock:", host: "kash.space", referrer: "https://kash.space/" 2015/06/23 14:54:16 [warn] 2572#0: *13768 an upstream response is buffered to a temporary file /etc/nginx/fastcgi_temp/4/14/0000000144 while reading upstream, client: 109.128.250.169, server: kash.space, request: "GET /file/4441267f722b75f221201bf6b4dc8fbb HTTP/1.1", upstream: "fastcgi://unix:/var/www/kash.space/php.sock:", host: "kash.space", referrer: "https://kash.space/"

considering non square and higher resolution images for ownyourgram

i’d vote for ownyourgram accepting non square images, it’s an option that you can activate in the instagram client configuration just a click away: http://stackoverflow.com/questions/32393998/instagram-api-return-not-square-photos-with-white-lines/32404380#32404380

cons:

  • micropub clients expecting square images
  • the new top-user overview, but that could use the thumnail image, that the API still return in square ratio:
[images] => stdClass Object
(
[low_resolution] => stdClass Object
(
[url] => https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/e35/p320x320/11376346_469642079882392_675297296_n.jpg
[width] => 320
[height] => 400
)
[thumbnail] => stdClass Object
(
[url] => https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e35/c0.135.1080.1080/11376346_469642079882392_675297296_n.jpg
[width] => 150
[height] => 150
)
[standard_resolution] => stdClass Object
(
[url] => https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/sh0.08/e35/p640x640/11376346_469642079882392_675297296_n.jpg
[width] => 640
[height] => 800
)
)

also, there’s an undocumented image format of 1080 x 1080 instead of only 640 x 640: http://stackoverflow.com/questions/14016142/instagram-api-custom-image-width/32070650#32070650

i think it would be nice to get a higher resolution image to my micropub endpoint, where i can still scal it down, if needed.

instagram verification fails

ownyourgram or indieauth adds a trailing slash to my domain (http://wirres.net) even if i try to auth with ownyourgram as http://wirres.net — instagram however removes the trailing slash that i enter into the external_url field.

also adding http://wirres.net/ to my bio fails, possibly due to caching the instagram responses.

so i can’t authenticate with ownyourgram right now, or only after i wait till the instgram response cache empties.

Clicking the "Upgrade Me" button doesn't change anything

Clicking the button under:

Upcoming change! The Micropub spec now requires values be sent as arrays instead of as comma-separated lists. When you are ready to receive the category property as an array, click the button below to switch.

Doesn't change anything.

OYG doesn't see my photos

Since yesterday night the "Import Photos" page shows the warning "We didn't find any photos in your Instagram profile" - and I'm wondering if it might be a unicode issue since the last picture has '🤓' as caption.

Can't verify instagram account - says my link is not on my profile page

I was trying to connect ownyourgram with my instagram account, but I keep getting told that it can't find the link to my website, from my profile page.

ownyourgram fails to find the URL on my instagram profile page

I've tried in the 'website' field and the 'bio' field. I was wondering if this could have something to do with instagram using what looks to be their own URL redirecter so the anchor element on the page looks like this:

blog.voss.co

When trying in the 'bio' field on the page, my address does show up, but ownyourgram still doesn't like it.

inside "bio" doesn't seem to cut it either

If I remove the URL from the bio, then the only place on the page I see my actual URL, protocol and all, is in what looks to be the JSON object called window._sharedData.

Is ownyourgram able to parse the JSON on the page for the URL back to my page?

When do I have to manually post a photo?

I posted a photo on Instagram this morning and it shows up in my dashboard on Ownyourgram. It has a Post button, but I want it to post automatically. That's what the service does right? Or do I have to manually go to the dashboard and post the photos myself?
And how would I know how long it will take for a photo to post automatically to my endpoint? How would I know about the possible errors?
I'm still learning...

Thanks!
Frank

I think I accidentally disconnected my account

I was just wanting to sort of look and see how things were setup and I started the process of linking my account but now, I don't think my existing setup is working anymore.

I'm not a new user - but a long standing one and I really hope I can get it to work again.

Help?

Posts with multiple photos send as undocumented `photo[]` arg

The docs say that for multiple photos only one file will be sent:

photo - The photo will be sent in a parameter named "photo". There will only be one photo per request. For Instagram videos, this will be the thumbnail of the video.

Still, in the dashboard there's an option to include all pics on multi photo post. But the payload actually includes all the photos under a photo[] arg, not photo (contrary to what the docs say). In some frameworks these two keys are actually different so the code needs to account for both possibilities.

The micropub spec says that photos will be sent as photo argument, not photo[] https://www.w3.org/TR/micropub/#uploading-files

Parameters

Testing my PHP endpoint - do all 10 parameters expect to be handled even if empty?

PESOS likes from Instagram

Since it's so easy to "like" things on Instagram, it would be great if OwnYourGram also crawled the photos you liked and posted "like" posts back to your micropub endpoint.

post-by-mail email subject not sent as "name" property

this is the $_POST variable that the micropub endpoint receives:

Array
(
[h] => entry
[access_token] => xxx
[content] => test — ignore
[published] => 2015-07-25T07:36:05+00:00
[syndication] => so sah ich meine mutter mit 8 jahren
)

looks like the email subject gets sent as the syndication property instead of the name property.

Error when using 'post' button

I had three Instagram posts that did not appear on my blog. First one posted fine when using the new 'post' button.

image

The other two threw errors.

image

image

Exception after auth'ing "Message: Undefined property: stdClass::$data"

Since changing my site from http -> https, OwnYourGram seemed to have trouble picking up my new updates on IG until I manually ask it to post them.

I tried to revoke the app's permission through IG and re-authorize, but now am hung up at an exception after logging in. Obviously non-urgent, and let me know if I can provide more detail. Thanks!

URL: https://ownyourgram.com/dashboard

Slim Application Error

The application could not run because of the following error:
Details
Type: ErrorException
Code: 8
Message: Undefined property: stdClass::$data
File: /web/sites/ownyourgram.com/lib/instagram.php
Line: 21
Trace

#0 /web/sites/ownyourgram.com/lib/instagram.php(21): Slim\Slim::handleErrors(8, 'Undefined prope...', '/web/sites/owny...', 21, Array)
#1 /web/sites/ownyourgram.com/controllers/controllers.php(76): IG\get_latest_photos(Object(ORM))
#2 [internal function]: {closure}()
#3 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Router.php(172):     call_user_func_array(Object(Closure), Array)
#4 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Slim.php(1222): Slim\Router->dispatch(Object(Slim\Route))
#5 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Middleware/Flash.php(86): Slim\Slim->call()
#6 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Middleware/MethodOverride.php(94): Slim\Middleware\Flash->call()
#7 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#8 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Slim.php(1174): Slim\Middleware\PrettyExceptions->call()
#9 /web/sites/ownyourgram.com/public/index.php(24): Slim\Slim->run()
#10 {main}

"Undefined index: category" when trying to send test post

I'm getting this error when I'm trying to send a test post after I've authorized myself using kodfabrik.se:

Slim Application Error

The application could not run because of the following error:
Details
Type: ErrorException
Code: 8
Message: Undefined index: category
File: /web/sites/ownyourgram.com/lib/helpers.php
Line: 99
Trace

#0 /web/sites/ownyourgram.com/lib/helpers.php(99): Slim\Slim::handleErrors(8, 'Undefined index...', '/web/sites/owny...', 99, Array)
#1 /web/sites/ownyourgram.com/controllers/controllers.php(153): micropub_post('http://micropub...', 'eyJ0eXAiOiJKV1Q...', Array, '/tmp/igD2Qmej.j...')
#2 [internal function]: {closure}()
#3 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Router.php(172): call_user_func_array(Object(Closure), Array)
#4 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Slim.php(1222): Slim\Router->dispatch(Object(Slim\Route))
#5 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Middleware/Flash.php(86): Slim\Slim->call()
#6 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Middleware/MethodOverride.php(94): Slim\Middleware\Flash->call()
#7 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#8 /web/sites/ownyourgram.com/vendor/slim/slim/Slim/Slim.php(1174): Slim\Middleware\PrettyExceptions->call()
#9 /web/sites/ownyourgram.com/public/index.php(24): Slim\Slim->run()
#10 {main}

Don't include timezone offset if timezone is unknown

Leave the date in UTC timezone, but don't include the timezone offset.

This seems to be the only way to indicate to a micropub endpoint the loss of precision so that it can set the timezone to its default.

RSS feed PubDate is Jan 01 1970 for items posted to WordPress

I'm unsure if this is specifically an OwnYourGram issue but posts from OwnYourGram to my WordPress blog end up with an invalid date in the RSS feed. No other "normal" posts have the problem, and the WordPress UI indicates the correct date so I'm not clear where the bad date is coming from.

Feed is here: https://snippets.baty.net/feed/

<link>https://snippets.baty.net/2017/816/</link> <comments>https://snippets.baty.net/2017/816/#respond</comments> <pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate>

"Post Again"

Post again gives an error when trying to "post again"

"There was an error posting the photo!"

But I'm not seeing any micropub post requests in my logs.

Syndication link not being passed through

I'm noticing that the syndication link isn't being passed to my Wordpress post when a gram is posted.

Thought it was an issue with Brid.gy at first, but then found no links back to Instagram from my post via OwnYourGram.

What I get, content wise, is...

<div class="e-content">
Beats to UX too
</div>

[gallery size=full columns=1]

Any ideas?

support syndicating to other silos

today at IWS, @scottjenson mentioned that it'd be nice if OwnYourGram could syndicate to other silos in the micropub request, if/when the server has any. @dshanske agreed. any interest in adding that?

i know it's probably non-trivial, and would take some extra UI. just a thought!

Import photos hanging

OwnYourGram was working for me until recently - first photos were registering with OYG but not posting to my known site, and now the photos tab just hangs with a spinning arrow. Any help would be much appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.