codemonauts / craft-instagram-feed Goto Github PK
View Code? Open in Web Editor NEWCraft CMS plugin to receive Instragram feed data as variable in templates
License: MIT License
Craft CMS plugin to receive Instragram feed data as variable in templates
License: MIT License
Is there a way to increase the page load speed? I'm caching for 3 weeks also within my templates but the initial load is fairly slow.
fetching instagram image, working fine. But when there is any video uploaded then no image shows or how can I ignore fetching the videos from the post? If there is no option then what how to manage a blank image tag when showing feed on the frontend?
Let me know if I am not clear.
I have installed this plugin on a client site and they have requested the 6hr default cache duration to be decreased. Is there any way to expose this parameter and set it in the config?
I could not see any documentation indicating that this is possible.
Thanks,
Rowan
the plugin was working fine for us with the hashtag but suddenly the feeds disappeared. FYI it wasn't working with username.
Is it possible to get the username for posts when getting a feed based on hashtag?
Is it possible to get the username dynamically from the entries?
{% for item in craft.instagram.getFeed("{{ entry.InstagramUrl }}")[:3] %} <div class="gallery"><img src="{{ item.src }}" alt="{{ item.shortcode }}"></div> {% endfor %}
** {{ entry.InstagramUrl }} is a custom field pulled from the CMS
This would allow a user to update it from the CMS
Using the following code it outputs all of the text (caption, likes, comments) but not the image. The image URL is being loaded in the code but not shown on the website. I'm developing locally. Any ideas why this would be happening? Thanks!
{% for item in craft.instagram.getFeed() %}
<a href="https://www.instagram.com/p/{{ item.shortcode }}/" target="_blank">
<img src="{{ item.src }}" alt="" />
</a>
<p>{{ item.caption }}</p>
<p>{{ item.likes }} Likes / {{ item.comments }} Comments</p>
{% endfor %}
I think the cache should be cleared if after someone updates username. After I changed, it still caches old account.
Also a cool feature would be to create ability to make multiple targets. For example I have a website with different categories of content and each might have a specific IG account I want to display posts from.
Thanks!
I had an issue on Black Friday, I'm assuming this was due to the amount of traffic on a very busy day. But the request to the proxy server was timing out, this was then throwing a timeout exception in Guzzle which was causing the homepage to return an error. For speed, I removed this section to fix the issue.
But I'm wondering if there is a way that I can catch the exception to then hide the section from my home page to prevent an error showing in future?
When i add 'craft.instagram.getFeed()' in my templates, it results in an internal server error.
yii\base\ErrorException: Undefined offset: 1 in /var/www/vhosts/sitename.com/httpdocs/vendor/codemonauts/craft-instagram-feed/src/services/InstagramService.php:73
Hey everyone
If you use our plugin and it stopped working in production but works perfectly on your local machine ( or on a different server, or has worked in the past and stopped working suddenly) you got hit by the bot detection from Instagram and they blocked the IP address of your server so our plugin can't get any images even for a public profile.
We have build a service which reroutes all requests from our plugin through a proxy so IG won't see the original source of the request and we can circumvent the blocking at the time pretty reliable. So if you have this problem, drop us an email at [email protected] an I will provide you the needed configuration and an access key to use our proxy which will get the plugin up and running on your website again :)
Best regards,
Felix
Hey guys,
I've been using your plugin for a while now and i thinks it great! Unfortunately when I activate the proxy with my personal key the website crashes (though the same proxy works fine on another of my websites).
Used config file
<?php
return [
'proxyKey' => '<mykey>',
'useProxy' => true,
'useGuzzle' => true,
'timeout' => 10,
];
Error message
2021-05-18 09:10:27 [-][1][bbvfier9udbrv39georro1al8k][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined index: graphql in /var/www/vhosts/example.com/httpdocs/vendor/codemonauts/craft-instagram-feed/src/services/InstagramService.php:162
Stack trace:
#0 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler->handleError()
#1 /var/www/vhosts/example.com/httpdocs/vendor/codemonauts/craft-instagram-feed/src/services/InstagramService.php(162): craft\web\ErrorHandler->handleError()
#2 /var/www/vhosts/example.com/httpdocs/vendor/codemonauts/craft-instagram-feed/src/services/InstagramService.php(51): codemonauts\instagramfeed\services\InstagramService->getInstagramTagData()
#3 /var/www/vhosts/example.com/httpdocs/vendor/codemonauts/craft-instagram-feed/src/variables/InstagramFeedVariable.php(11): codemonauts\instagramfeed\services\InstagramService->getFeed()
#4 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Extension/CoreExtension.php(1511): codemonauts\instagramfeed\variables\InstagramFeedVariable->getFeed()
#5 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute()
#6 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/54/541ed543f52e4e8980fd48baa5361cba49c8e88ead0f76dd07413fd075cbbbf9.php(41): craft\helpers\Template::attribute()
#7 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(405): __TwigTemplate_f2144b4525d7f58aff99c533d58dec700be86ff33c09b9634a4d3a3f385d586a->doDisplay()
#8 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#9 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/96/9674ab6b333298af86ac09a32e99f1b7a34075ce62df4a09c96274d2702633f9.php(69): Twig\Template->display()
#10 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(405): __TwigTemplate_1a55f3bea29ec200124923e51477c528f9570da38eae62e3e8003194b7d4e0cf->doDisplay()
#11 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#12 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/c3/c3af3a3564b22141ab0f2d452f7b69f2bc75ef76ed04e5fbb3dc2fae5a2e47f4.php(46): Twig\Template->display()
#13 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(405): __TwigTemplate_aa13b344613fbb25346ac2e8f8439f9a1696ffda5260cf619f50cbd61783c843->doDisplay()
#14 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#15 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/64/64f6a6fd8ac44890777cc79cf3b6b189233ba28ac04d47d95e14d56139297e95.php(124): Twig\Template->display()
#16 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(405): __TwigTemplate_3b9c71a224c354b6ad5b975c3b2e3a51f2815a3f1e376a9f191a195913c72753->doDisplay()
#17 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#18 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/49/49045e82490a162883d118283166f16ba4eb10bf4fb05772a94796ce92119dc5.php(41): Twig\Template->display()
#19 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(405): __TwigTemplate_4bf9f501be3f68dd84aebbc079a90366661776d93eef2abd265c96e94e470391->doDisplay()
#20 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#21 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/ba/bab6f32117369b81ab2c003d08cf9e60ec9be651be836b39f9272f702e7f3a10.php(56): Twig\Template->display()
#22 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(182): __TwigTemplate_503a5803bba0f4b6576a67d27e6f4c73ab30817fa2253cb7566d625538cfd608->block_page_main()
#23 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/73/7384d716fb4878ed222eef4d398a873cb3c2f53440ef2427ae9835aaa0a181e4.php(442): Twig\Template->displayBlock()
#24 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(405): __TwigTemplate_3765b26491e15997bd74d394d909994f7c2ae9eba77187446d2b96c76050dba1->doDisplay()
#25 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#26 /var/www/vhosts/example.com/httpdocs/storage/runtime/compiled_templates/ba/bab6f32117369b81ab2c003d08cf9e60ec9be651be836b39f9272f702e7f3a10.php(43): Twig\Template->display()
#27 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(405): __TwigTemplate_503a5803bba0f4b6576a67d27e6f4c73ab30817fa2253cb7566d625538cfd608->doDisplay()
#28 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#29 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#30 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render()
#31 /var/www/vhosts/example.com/httpdocs/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render()
#32 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/web/View.php(389): Twig\Environment->render()
#33 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/web/View.php(450): craft\web\View->renderTemplate()
#34 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/web/Controller.php(257): craft\web\View->renderPageTemplate()
#35 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/controllers/TemplatesController.php(100): craft\web\Controller->renderTemplate()
#36 [internal function]: craft\controllers\TemplatesController->actionRender()
#37 /var/www/vhosts/example.com/httpdocs/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#38 /var/www/vhosts/example.com/httpdocs/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams()
#39 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction()
#40 /var/www/vhosts/example.com/httpdocs/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction()
#41 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/web/Application.php(278): yii\base\Module->runAction()
#42 /var/www/vhosts/example.com/httpdocs/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction()
#43 /var/www/vhosts/example.com/httpdocs/vendor/craftcms/cms/src/web/Application.php(263): yii\web\Application->handleRequest()
#44 /var/www/vhosts/example.com/httpdocs/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest()
#45 /var/www/vhosts/example.com/httpdocs/web/index.php(21): yii\base\Application->run()
#46 {main}
Just asking if there is a config setting or query parameter to limit the number of instagram images returned?
Hey any way for it to load more than 12 posts?
Can't see anything in the documentation
Thanks
Hey,
today i noticed, that your plugin is no longer working. Our public account feeds remain empty.
i checked the logs:
[trace][codemonauts\instagramfeed\services\InstagramService::getFeed] Get feed for "@__PUBLIC_PROFILE__"
[trace][codemonauts\instagramfeed\services\InstagramService::getFeed] No cached data found, start fetching Instagram page.
[trace][codemonauts\instagramfeed\services\InstagramService::fetchInstagramPage] Using php file stream to fetch Instagram page.
[trace][codemonauts\instagramfeed\services\InstagramService::parseInstagramResponse]
[error][codemonauts\instagramfeed\services\InstagramService::parseInstagramResponse] Unknown response from Instagram. Please check debug output in devMode.
[trace][codemonauts\instagramfeed\services\InstagramService::getFeed] Returning cached items.
I debugged a little into your plugin and it seems that fetching the feedpage doesn't return anything at the moment. Did Instagram change something with their restrictions?
Hello and thank you for the great plugin!
Unfortunately I have a problem it and it's not working on a production server (https://merchery.co/).
I tried everything, activate 'useGuzzle', configure through the config file. To see if it would change anything but nothing appears on the page, I have no problem on staging though (http://merchery.staging.treeleaf.io/). The production server is hosted there (ovh.com) we have no control over the server config but the allow_url_fopen is on and the staging is on a digital ocean droplet.
In web.log I only have this message :
[-][11][-][error][codemonauts\instagramfeed\services\InstagramService::getInstagramAccountData] Instagram profile data could not be fetched. Maybe the site structure has changed.
Do you have an idea of what it could potentially be ?
{% set ig = user.instagram|split('/')|slice(3, 3)|join %}
{{ ig }}
{% set items = craft.instagram.getFeed("{{ ig|spaceless }}") %}
Doing this makes the feed not load at all, but when inserting the text the variable prints manually it works perfectly?
It would be good if you could get the username that is set in the settings, and output as a variable in twig.
A use case for this is to link direct to the instagram profile
Hi,
I have a problem with the likes on my page using this plugin, every 5-10 photo has a wrong number of likes. On instagram i got like 600 likes and on my site it says 81. Do you know where the problem is?
Thank you
This is more a feature request than an issue, it would be nice to be able to get the dates of posts so they can be used for things like a news feed.
Love the plugin by the way :)
Hey,
in src/controllers/ImageController.php, you read from a file with unsanitized user input. Even if it's not super exploitable as you append static strings I would prefere some user input validation. You can copy/paste from the docs:
https://docs.craftcms.com/api/v3/craft-web-response.html#method-sendfile
I hope we left the time where you can send null bytes to php with %00.
Since the last update (Craft CMS 3.3.17) Craft Instagram Feed doesn't work anymore.
Hi!
Is it possible to add the caption?
Thanks!
foreach($media['node']['edge_media_to_caption']['edges'] as $caption){
$item['caption'] = $caption['node']['text'];
}
The feed I'm getting is not up to date per today, got this in the log:
2019-10-10 09:44:41 [-][1][-][error][codemonauts\instagramfeed\services\InstagramService::getInstagramAccountData] Instagram profile data could not be fetched. Maybe the site structure has changed.
It's working fine on my local install (MAMP), on the live site all I get in web.log iis
2019-05-09 20:08:51 [-][1][-][error][codemonauts\instagramfeed\services\InstagramService::getInstagramData] Instagram profile data could not be fetched. Wrong account name or not a public profile.
2019-05-09 20:08:51 [-][1][-][info][application] $_GET = []
yet the account name is correct and it is a public profile. Any suggestions for further debugging?
Hi
I know the plugin pulls in the first 12 images, but I was wondering if there's a way to make the limit customisable?
I'm only looking to grab the first 4—6 posts.
Any help would be appreciated. Thanks!
Is there any option for the limit of the pictures? Now its 12 by default.
And, is there a way to get the original source of an image and not a cropped square?
Hi,
Thank you for this plugin.
Is it possible to access the feed with a graphql query ?
I am just trying out this plugin, and it isn’t able to pull anything from instagram. I saw this error in my log:
[-][1][-][error][codemonauts\instagramfeed\services\InstagramService::getInstagramAccountData] Instagram profile data could not be fetched. Maybe the site structure has changed.
I noticed recently Instagram changed such that you can’t even see public profiles on the web without logging in? Or maybe my IP (local machine) is blocked by instagram? Not sure.
Is it possible to configure multiple accounts within one craft installation?
Thank you for a great plugin.
We are running into the issue with our Live-server being blocked by instagram, but our internal server IP isn't. It would be great to have the option to configure your own proxy URL, instead of having put the burden on you.
Thanks,
Erik
Just updated to 1.0.6 and now getting this:
PHP Notice – yii\base\ErrorException
Undefined index: has_audio
/vendor/codemonauts/craft-instagram-feed/src/services/InstagramService.php
307: $item['hasAudio'] = $item['isVideo'] ? (bool)$media['node']['has_audio'] : false;
Hey folks,
I just deployed the site to a new server (Nexcess) and I'm having issues getting anything to display.
its working locally for me, but not on my staging or production servers.
I am using Cloudflare for DNS, is this possibly the issue? I see that there are proxy settings available, but could you provide me with some guidance on how to configure this if I'm using Cloudflare for DNS?
Thank you,
Rowan
This is more of a question - I'm trying to query for all non-video format posts, something like the following:
{% set instaFeed = craft
.instagram
.isVideo(false)
.getFeed()[: 6] %}
Is there a way to do this in twig?
I know I could put a condition in within the loop to check this status, but that's messing with the limit filter as I need to show 6 non video posts, rather than grabbing 6 posts first, and then filtering out the video posts.
Hey guys,
I tried out your plugin inside a freshly installed testing environment, just to see how the results are parsed.
Unfortunately I'm not able to get the plugin going. I feel like it's more a instagram structure change than a bug.
2021-02-09 09:25:26 [-][1][-][error][codemonauts\instagramfeed\services\InstagramService::getInstagramAccountData] Instagram profile data could not be fetched. Maybe the site structure has changed. 2021-02-09 09:25:26 [-][1][-][trace][codemonauts\instagramfeed\services\InstagramService::getFeed] Returning cached items. 2021-02-09 09:25:26 [-][1][-][profile end][Twig template] render template: instagram 2021-02-09 09:25:25 [-][1][-][info][application] $_GET = [ 'p' => 'instagram' ]
Can anyone else report about this error?
Can we make this url configurable so that we can set-up our own proxy?
Thanks!
Hi there, I've just updated the Instagram Feed plugin to the latest version and am encountering an issue where the feed is working just fine on my development server and my staging server. But in production, the plugin isn't pulling in any images. There aren't any differences in the server environments from what I can tell and I've tried switching to guzzle but still nothing. Also allow_url_fopen is set to 1 on all 3 environments.
Hi,
I have a problem here.
Instagram-feed is working on local site but not on production site.
can you please help me with this as soon as possible?
Hi Codemonauts,
Since Saturday we have an issue with a website that makes use of the amazing proxy solution.
Loading of the website is completely blocked and is spitting out the following message:
GuzzleHttp\Exception\ConnectException cURL error 28: Operation timed out after 5001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
Looks like something is going wrong with the connection to the proxy server?
It stays in this loop with retrying and the rest of the website is not getting loaded.
If more info is needed please let us know
Recently configured with proxy as described in #32. Things were working OK on both dev and staging, but now all pages that incorporate the plugin generate internal server error:
GuzzleHttp\Exception\ConnectException cURL error 28:
Operation timed out after 10002 milliseconds with 0 bytes received
The only output i'm seeing is this:
[0]=>
array(6) {
["src"]=>
string(310) "https://scontent-ams4-1.cdninstagram.com/v/t51.2885-15/sh0.08/e35/c240.0.959.959a/s640x640/214449600_895916131268755_8566997712571008720_n.jpg?_nc_ht=scontent-ams4-1.cdninstagram.com&_nc_cat=107&_nc_ohc=pzMYh0THixEAX8zyhOE&edm=ABZsPhsBAAAA&ccb=7-4&oh=68bb1a8d386dcf7727640bb85f806722&oe=60F8E6A7&_nc_sid=4efc9f"
["likes"]=>
int(12)
["comments"]=>
int(0)
["shortcode"]=>
string(11) "CRLU2-BjLNb"
["timestamp"]=>
int(1625985185)
["caption"]=>
string(140) "Today the @3_nations_cup_mtb with @exventure_sports.
Time for jumps 🤙
#exventure #3nationscup #mtbspaarnwoude #xco #uci #talentned #mtb"
}
Could it be that instagram's structure has changed once again?
Hi Folks
Spent the morning implementing your new system. Thanks for making the changes, and so quickly.
I got it working on dev, after some mucking about - might be worth noting in your docs that during testing it is handy to clear caches as basically if there is an issue with e.g. saving an image, you can't really fix this without clearing the cache (it seems).
Once I had it working and saving the images to our volume (on S3), I then uploaded the changes to production.
It did not work there....checking the logs I see:
2021-04-30 11:55:52 [-][1][-][error][application] Could not save Instagram image to volume: A file with the name “CN9WShFDNCN.jpg” already exists.
2021-04-30 11:55:53 [-][1][-][error][application] Could not save Instagram image to volume: A file with the name “CNrTYoZAtGA.jpg” already exists.
2021-04-30 11:55:53 [-][1][-][error][application] Could not save Instagram image to volume: A file with the name “CNmBGgQjPN0.jpg” already exists.
2021-04-30 11:55:53 [-][1][-][error][application] Could not save Instagram image to volume: A file with the name “CNWMrIxDCTO.jpg” already exists.
(etc)
So it seems it was (not surprisingly) trying to re-download the images as it built the feed cache on production. Given they already exist, you would think this would work, but the images were missing on loading the page in question on production - I had to manually delete them from our s3 bucket, clear cached, and re-load before the production server would display the images. I presume the local feed cache does not get built with such errors encountered - but really if they exist on the volume, it should just point at them, shouldn't it? Otherwise folks will likely have regular problems moving between dev and prod, I think.
Of course I may well be misunderstanding something here...please let me know if so!
Plugin is working very well but just for videos no image loads and a console log error appears:
139702539_435660231134195_1029140841979079187_n.jpg:1 Failed to load resource: the server responded with a status of 403 ()
If I try to load the image URL in the browser it says: URL signature expired
Photos and slideshows are loading just fine. This problem just occurs with video as far as I can tell. Any ideas?
How would you go about limiting the number of images to show?
I see that there are two options:
However, it is possible to create a feed from an Instagram account that is filtered by a hashtag?
Thanks!
Hi,
This plugin doesn't work for a public Instagram account. It is not returning any feeds when using a username.
But it is just working fine when we use hashtags. Can you fix this?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.