codefog / contao-instagram Goto Github PK
View Code? Open in Web Editor NEWContao extension that displays Instagram feed on your website
License: MIT License
Contao extension that displays Instagram feed on your website
License: MIT License
Ich bin auf Contao 4.9
Wenn ich meinen Feed aktualisieren möchte, indem ich das Kontrollkästchen "Token" aktiviere, wird folgende Meldung angezeigt: "Instagram erlaubt keine Verbindung"
Will there be support for contao 5?
since the update, data for the likes and the comments seem to be missing.
before we could use the $item['likes']['count'] and $item['comments']['count'].
Is this information still available in the new API?
Would it be possible to add them again?
Hello Kamil,
we want to use your extension in a new Contao 4.13.38 project. I had installed the extension (Version 2.3.5) a couple of weeks ago and are currently wondering why the feed won't be updated. Since than a couple of postings were made on Instagram. But in the frontend I can only see data from the past.
Did I miss to configure an update trigger?
Kind regards
Dennis
Within the config.yml I have:
access_token_ttl: 28800 # 8h access token local time to live after which Contao will make a request to refresh the token, in seconds
cache_ttl: 1800 # 30 min feed data cache local time to live, in seconds
As discussed on slack (https://contao.slack.com/archives/CLTUNH78X/p1657699418985049), there might be a problem if instagram answers with empty media data.
The $url
is not set here:
contao-instagram/src/InstagramClient.php
Lines 131 to 137 in ceb8df7
The empty $url
leads to a GuzzleHttp\Exception\RequestException
which is not catched here:
contao-instagram/src/InstagramClient.php
Line 150 in ceb8df7
The exception should be catched and/or empty $url
should be handled
At the moment, long-lived instagram tokens expire after 60 days, making it necessary to create a new token about every two months. This is tedious, tbh.
Is there a possiblity to add a cronjob to the bundle, that refreshes the token after e.g. 30 days via the corresponding endpoint of the Basic Display API?
We already got several clients calling, asking why the feed is not showing posts anymore...
Thank you very much!
Now that video & carousels are included, we would love to have also preview images of those types in Contao.
So we do not need to load the preview images external from instagram.
if "media_type" => "VIDEO" the is a preview image in "thumbnail_url"
if "media_type" => "CAROUSEL_ALBUM" the is the first image in "media_url"
would it be possible to download those images to Contao and use them just as we can use the images of the normal image posts?
solved - apologies, this can be deleted
Hi
after installing the module on Contao 4.7 and adding the FE-Module everything worked fine until I changed the value of field numberOfItems to 0.
After doing so there is no output for the FE-Module anymore and no error in /var/logs/.
The module does not catch the cURL error if instagram ist not reachable.
request.CRITICAL: Uncaught PHP Exception GuzzleHttp\Exception\ConnectException: "cURL error 6: Could not resolve host: graph.instagram.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)" at /vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php line 200 {"exception":"[object] (GuzzleHttp\Exception\ConnectException(code: 0): cURL error 6: Could not resolve host: graph.instagram.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) at /vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:200)"} []
Hi Kamil,
yesterday i installed the Instagram bundle, generated die Client ID and secret, got the asscess token.
After including the module into an article nothing is shown. No media also also no code when checking the source code.
Today i found out that the date format in settings wasn't set right.
H.i instead of H:i
After setting to H:i all media are shown in frontend.
May be a hint to build some code in to show an error or giving a hint.
Cheers
Thomas
In unregelmäßigen Zeitabständen haben wir das Problem, dass ein Video nicht angezeigt wird, obwohl der dahinterstehende Videolink, der im eingebunden war, auch existiert und aufrufbar war. Stattdessen wird dann nur das Alt-Tag angezeigt.
Es handelt sich um die Seite: https://beefriendly-earth.de
PHP Version: 7.4.10
Contao Version: 4.4.48
Codefog/Contao-Instagram Version: 2.1.2
instagram changed the api and now the module is not working anymore. see -> https://www.instagram.com/developer/changelog/ - some endpoints are deprecated.
ps: your module is great
i think you can fix it like that
in InstagramModule.php line 91
....
/*if (($userId = $this->fetchUserId()) === null) {
return [];
}*/
//fetchUserId not neccecary now, because instagram allows only self data
$response = $this->sendRequest(sprintf('https://api.instagram.com/v1/users/self/media/recent', $userId), ['count' => $this->numberOfItems]);
.....
If I click the checkbox to get an Access Token, I get this JSON error.
error_typeOAuthException
code400
error_messageInvalid scope field(s): public_content
Hi guys—very nice improvement to this extension! After reviewing the code, I'm wondering if the long-lived access token will simply expire after 60 days, or will it remain valid? I don't see any functionality built in here to reresh the access token, so I'm worried about leaving this on a client's site for more than a couple of months. Thoughts?
Hi, basically this bundle works well for me. But from time to time the images stop appearing. I tried to get a new access token, but I always get this error:
{"error_type": "OAuthException", "code": 400, "error_message": "Invalid scope: []"}
What can I do to fix that?
Thank you,
Best regards,
Daniel
Unfortunately it is still necessary to request a new access token to get the newest post - can anybody reproduce this?
Contao: 4.4.45
contao-instagram: 2.10
Über die Api gibt es unterschiedliche Auflösungen die man mit in der Modulkonfiguration packen könnte
thumbnail ->width: 150, height: 306
low_resolution -> width: 306, height: 306
standard_resolution -> width: 612, height: 612
z. B.:
<?php
$item['images']['thumbnail']['url']
$item['images']['thumbnail'] ['width']
$item['images']['thumbnail']['height']
....
<img src="<?= $item['images']['thumbnail']['url'] ?>" alt="<?= specialchars($item['caption']['text']) ?> width="<?= $item['images']['thumbnail']['width'] ?>" height="<?= $item['images']['thumbnail']['height'] ?>">
Gruß Olli
Hi Kamil,
I run into a problem with the lastest version commited some days ago with a Contao 4.4.47 installation. The Contao Manager exits with an undefined error. Here is the stack-trace:
> Resolving dependencies using Composer Cloud v2.2.6
$ /usr/local/bin/ed-php-cli-73 -q /home/vz531nap/www/home/clients/_c44/web/contao-manager.phar.php composer install --prefer-dist --no-dev --no-progress --no-suggest --no-ansi --no-interaction --optimize-autoloader
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
contao/manager-plugin: Generating plugin class...
contao/manager-plugin: ...done generating plugin class
Fatal error: Uncaught Error: Call to undefined method Symfony\Component\Config\Definition\Builder\TreeBuilder::getRootNode() in /home/vz531nap/www/home/clients/_c44/vendor/codefog/contao-instagram/src/DependencyInjection/Configuration.php:16
Stack trace:
-0 /home/vz531nap/www/home/clients/_c44/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php(50): Codefog\InstagramBundle\DependencyInjection\Configuration->getConfigTreeBuilder()
-1 /home/vz531nap/www/home/clients/_c44/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/Extension.php(102): Symfony\Component\Config\Definition\Processor->processConfiguration(Object(Codefog\InstagramBundle\DependencyInjection\Configuration), Array)
-2 /home/vz531nap/www/home/clients/_c44/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php(35): Symfony\Component\DependencyInjection\Extension\Extension->processConfiguration(Object(Codefog\InstagramBundle\DependencyInjection\Configu in /home/vz531nap/www/home/clients/_c44/vendor/codefog/contao-instagram/src/DependencyInjection/Configuration.php on line 16
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 1 update, 0 removals
- Updating codefog/contao-instagram (2.1.0 => 2.1.1): As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' may remediate them.
Loading from cache
Generating optimized autoload files
> Contao\ManagerBundle\Composer\ScriptHandler::initializeApplication
Script Contao\ManagerBundle\Composer\ScriptHandler::initializeApplication handling the post-install-cmd event terminated with an exception
In ScriptHandler.php line 113:
An error occurred while executing the "contao:install-web-dir" command:
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>...]
Process terminated with exit code 1
Result: General error
---
Thanks a lot,
Sascha
Hello, I just updated to the newest version and noticed that it is now possible to get video media. Can you add "thumbnail_url" to the list of fields in the following line, so that it is possible to use them as video posters?
contao-instagram/src/InstagramClient.php
Line 96 in 85527dc
Hello, I am using the extension for the first time and get an error message:
It runs fine for a while, then after a few minutes the error chops the whole page
Contao 4.9.3
GuzzleHttp/6.5.5
curl/7.58.0
PHP/7.4.5
[2020-06-19 09:22:19] request.INFO: Matched route "tl_page.2.root". {"route":"tl_page.2.root","route_parameters":{"_token_check":true,"_controller":"Contao\\FrontendIndex::renderPage","_scope":"frontend","_locale":"de","pageModel":"[object] (Contao\\PageModel: {})","_route":"tl_page.2.root"},"request_uri":"https://www.z-connection.de/","method":"GET"} []
[2020-06-19 09:22:19] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-06-19 09:22:19] request.CRITICAL: Uncaught PHP Exception GuzzleHttp\Exception\RequestException: "cURL error 3: <url> malformed (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)" at /www/htdocs/[REMOVED]/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php line 201 {"exception":"[object] (GuzzleHttp\\Exception\\RequestException(code: 0): cURL error 3: <url> malformed (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) at /www/htdocs/[REMOVED]/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:201)"} []
Stacktrace:
contao-instagram_error.txt
Hey, are there plans to provide the extension for PHP8?
Hi, since some days images are not shown anymore after importing them from Instagram. See here https://www.heiserimkerei.de/ueber-uns/instagram.html
Instagram changed the image format to HEIC, which the importer is not recognizing. In the source code is only an empty img tag visible.
Is there a way I can work around this or is there a fix already?
After updating from an older v1 version of this plugin we get this error:
Integrity constraint violation: 1062 Duplicate entry '53' for key 'PRIMARY'" at /var/www/vhosts/***/httpdocs/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 74 null []
We could get a Instagram Access Token and the images are sucessfully downloaded.
But the frontend generates this error.
When I try to request the access token (fresh install), I am redirected to Instagram; then I allow the app to share information, and after clicking on "Allow", I get redirected to my installation where the following error is displayed:
Attempted to call an undefined method named "fetchAssoc" of class "Doctrine\DBAL\Connection". Did you mean to call "fetchAssociative"?
Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\UndefinedMethodError: "Attempted to call an undefined method named "fetchAssoc" of class "Doctrine\DBAL\Connection". Did you mean to call "fetchAssociative"?" at /var/www/vhosts/client/httpdocs/contao-4-13/vendor/codefog/contao-instagram/src/Controller/InstagramController.php line 92 { "exception": {} }
Stack trace:
Symfony\Component\ErrorHandler\Error\UndefinedMethodError:
Attempted to call an undefined method named "fetchAssoc" of class "Doctrine\DBAL\Connection".
Did you mean to call "fetchAssociative"?at vendor/codefog/contao-instagram/src/Controller/InstagramController.php:92
at Codefog\InstagramBundle\Controller\InstagramController->authAction()
(vendor/symfony/http-kernel/HttpKernel.php:152)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
(vendor/symfony/http-kernel/HttpKernel.php:74)
at Symfony\Component\HttpKernel\HttpKernel->handle()
(vendor/symfony/http-kernel/Kernel.php:202)
at Symfony\Component\HttpKernel\Kernel->handle()
(web/index.php:44)
Changing "fetchAssoc" to "fetchAssociative" in vendor/codefog/contao-instagram/src/Controller/InstagramController.php line 92 solved the problem for me.
Hi!
I installed contao-instagram, set it all up and it seemed to work just fine.
It retrieved the Access Token and the frontend module displayed postings from IG on the website.
A few hours later i started getting this error in the Contao log whenever i open the page with the module...
Unable to fetch Instagram data from "https://graph.instagram.com/me/media": Server error:
GET https://graph.instagram.com/me/media?access_token=TokenReplacedByMe&fields=id%2Ccaption%2Cmedia_type%2Cmedia_url%2Cpermalink%2Cthumbnail_url%2Ctimestamp
resulted in a500 Internal Server Error
response: {"error":{"message":"An unexpected error has occurred. Please retry your request later.","type":"OAuthException","is_tra (truncated...)
...and the content element is not displayed at all on the page.
I thought maybe the token had expired so i request a new one, which worked but didn't solve the problem.
Not sure if this is a problem with Instagram or contao-instagram because of the error code 500. Is anyone else getting this?
Es gibt wohl nun Long-Live Tokens: https://developers.facebook.com/docs/instagram-basic-display-api/guides/long-lived-access-tokens
Seems like instagram retired some api endpoins.
https://api.instagram.com/v1/users/search, Array ( [q] =>xxxxxx [count] => 1 [access_token] => xxxxxx ) , Array ( [meta] => Array ( [code] => 400 [error_type] => APINotAllowedError [error_message] => This endpoint has been retired ) )
Hi Kamil,
could you please check if its possible to update this requirement:
"doctrine/cache": "^1.9",
it competes with the settings of metamodels which I need in a project:
Problem 1
- codefog/contao-instagram[2.3.0, ..., 2.3.5] require doctrine/cache ^1.9 -> found doctrine/cache[1.9.0, ..., 1.13.0] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires codefog/contao-instagram ^2.3 -> satisfiable by codefog/contao-instagram[2.3.0, ..., 2.3.5].
- metamodels/core dev-feature/2.3.0 requires doctrine/cache ^2.1 -> found doctrine/cache[2.1.0, 2.1.1, 2.2.0] but it conflicts with your root composer.json require (^1.9).
thanks!
We have an video in the feed and the extension show an black image. The link works correct.
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.