Giter Site home page Giter Site logo

laravel-instagram-feed's People

Contributors

adsy2010 avatar ascentcreative avatar christophheich avatar corbancode avatar dependabot[bot] avatar indykoning avatar joshuadegier avatar m-lotze avatar michaeljoyner avatar omarmatijas avatar spoyntersmith 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-instagram-feed's Issues

Update Typage LOG.warning: Return type

    public function getIterator()
    {
        return new ArrayIterator($this->items);
    }

 LOG.warning: Return type of Dymantic\InstagramFeed\InstagramFeed::getIterator()

    public function count()
    {
        return count($this->items);
    }

LOG.warning: Return type of Dymantic\InstagramFeed\InstagramFeed::count() should either be compatible with Countable::count(): int,


TO

   public function getIterator() : ArrayIterator
    {
        return new ArrayIterator($this->items);
    }

    public function count() : Int
    {
        return count($this->items);
    }

Can you update the function ?

Thank You for your instagram module

Limit and fields

Is there a reason why the limit of feed items is hardcoded to 20? Could you make this configurable, so that we can get more items? Or even better, add some kind of pagination, like

Profile {
...
    public function feed($limit = 20; $start = 0) {
         ...
    }
...
}

And please add more fields than just the type and media_url. e.g. the caption and the id would be good, so we can link directly to the post.

Getting auth (The OAuth flow)

I'm following the tutorial you made, https://github.com/Dymantic/laravel-instagram-feed/blob/master/tutorial.md

and I think something is wrong with the auth link <a href="{{ $instagram_auth_url }}">Click to get Instagram permission</a> it turns out I get the wrong link. Even though I already fill the config/instagram-feed.php

the link calls back into this.
https://api.instagram.com/oauth/authorize/?client_id=YOUR%20INSTAGRAM%20CLIENT%20ID&redirect_uri=127.0.0.1/instagram/auth/callback&scope=user_profile,user_media&response_type=code&state=1

so the data I already put in config/Instagram-feed.php doesn't change the client_id and redirect_uri

another thing is, in the tutorial under auth_callback_route part, you were saying

Then your config should have the route that matches everything after the forward slash following your app_url (https://example.test/ in this case).

Note that you can use more than one url in your Facebook settings, so you can add a url for local dev as well.

you were saying, we can also put the local URL for local dev. But it turns out, Instagram asking for HTTPS in OAuth Redirect URIs

Actually, I already have done Instagram feed using a CURL PHP script, but I want to know how it does in Laravel 7 with this package. I hope this package can link our website with social media faster than CURL opt.

refresh-feed doesn't work if run by laravel scheduler

Hi,

I wonder if you can help me diagnose something.

Every few days, my client's IG feed starts returning 302 errors for the images in the feed. The page code only calls "feed" not "refresh" (to save loading times). So, I manually run "php artisan instagram-feed:refresh 200" and it fixes it, as expected.

However, I've set that command to also run in Laravel's scheduler:


$schedule->command('instagram-feed:refresh 200')
                    ->everyMinute()
                    ->emailOutputTo('[email protected]');

        $schedule->command('instagram-feed:refresh-tokens')->monthly(); 

Both tasks show in php artisan schedule:list, and the refresh-tokens is working fine. For some reason, the feed refresh doesn't seem to work though (and I don't get any failure messages either). The feed starts returning 302 codes again, and I have to trigger the command manually to fix it.

Can you shed any light on why this might be?

Sorry, we failed to get permission to use your insagram feed.

Hey so I've recently been trying to use this to implement a basic instagram gallery for a website.
So I've setup the code as per the tutorial, upon clicking "allow" on the instagram page, I am re-directed back with '?result=failure#_'
Is there anything specifically that I could be doing wrong?

I'm thinking I may need to request further permissions from instagram? Does this require graph_user_media permissions in the meta developers to run?

I appreciate any help if you have the time to give me a few pointers in the right direction.

Posts without a caption cause the feed refresh to fail

When trying to pull a feed which has at least 1 post without a caption, the entire refresh fails as there is an undefined index of caption.

MediaParser.php should check if the array key 'caption' exists and if not default it to NULL.

Config APP_URL

Hi Thank you for a remarkable package.
I'm currently using this.

Is there a way where instead of using .env APP_URL variable, use
other .env variables? without editing the package?

image

I'm asking this currently my project is running subdomains, I'm having problem with regards to the callback parameter because of my subdomains

PHP version clash?

Hi, I'm trying to integrate your package with my project and I got the following errors in PHP. I was doing so well until then! Thanks for all your hard work. I'm running PHP 8.1.2

PHP Deprecated: Return type of Dymantic\InstagramFeed\InstagramFeed::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forge/test.cyclotour.ch/vendor/dymantic/laravel-instagram-feed/src/InstagramFeed.php on line 42

PHP Deprecated: Return type of Dymantic\InstagramFeed\InstagramFeed::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forge/test.cyclotour.ch/vendor/dymantic/laravel-instagram-feed/src/InstagramFeed.php on line 47

PHP Error: Class name must be a valid object or a string in /home/forge/test.cyclotour.ch/vendor/dymantic/laravel-instagram-feed/src/InstagramFeed.php on line 22

Redirect to instagram-auth-failure

image

Hi Michael, its me again. We were granted permission from facebook to use instagram_graph_user_profile & instagram_graph_user_media but when I try to use a non tester instagram account im always redirected to instagram-auth-failure route. If I connect using a tester account everything works fine. Is there a way to view the error or exception?

Im sorry for my bad english.
Thank you always for your help and for this great package.

Cannot use object of type Dymantic \ InstagramFeed \ InstagramMedia as array

Hello,

Thank you in advance for your assistance,
Thanks for your plugin

I have a problem when I want to display the Instagram feed I added the profile, the token, everything, and authorize but when displaying the foreach I get the following error

Cannot use object of type Dymantic \ InstagramFeed \ InstagramMedia as array

my sight :
$feed = \Dymantic\InstagramFeed\Profile::where('username', 'myaccount')->first()->feed($limit = 10);

my controller:
return view('frontend.index', compact('categories'))->with(['instagram' => $feed]);

thank you for your help

Token refresh issue

Hi, @michaeljoyner
I hope you doing good.
My app has expired and when I run the refresh token command it does not update the token.

php artisan instagram-feed:refresh-tokens

image

Can't get the token to register

Hello,

Doing the procedure, I get to the Instagram Autorisation and back to the callback address...

Sadly, Instagram return this as "state"
"state" => "7.4.3162ms18MBGET instagram/auth0 statements were executed0μs"

So the AccessTokenController is unable to find the matching Profile and register the token. What am I doing wrong?

EDIT // I found the issue in my code where it changed the state at the end of the link...

Image thumbnail

Hi michaeljoyner,
I hope that you are doing well, I have been used "laravel-instagram-feed" package to get and show the instagram feeds and it is working fine. I am very impresses with this package and I will recommend to all of you to use it to show the instagram feeds. I am facing a issue, how to fetch the thumbnail size of the image, because when I fetch the feeds and show the feed image in small div size, then the image will lose the quality. Please help me to fix it.
Thanks

Suggestion : offering the thumbnail link

Hello there,

I'm trying to override the parseMedia method... or simply return the default object from Instagram rather than your parsed feed...

I need to get the thumbnail for the video, not the video itself.

Could you add an option to allow this?

Thanks.

Undefined array key "media_url"

I am using version laravel-instagram-feed 2.0 . Suddenly I am getting this error.

I am getting this response. media_url key is not there.
array:2 [▼
"media_type" => "IMAGE"
"id" => "17948247578113710"
]

Posts after first page get lost

Instagram Basic API has limitations

Ordering posts is not supported, therefore anything after page 1 is disregarded. For accounts with greater than 99 posts, I propose fetching all results and creating a collection from that using a limit.

Page one results are not the latest posts.

This Issue and PR #19 could allow users to sort posts by their timestamp.

Cannot get more than 15 items in a feed.

I'm not sure if this project is actively maintained anymore - but if it is, any insight as to why i can not see more than 15 results at a time? Additionally, is there a way to force latest/oldest posts first?

php artisan instagram-feed:refresh 100

$feed = \Dymantic\InstagramFeed\InstagramFeed::for('profilename',100);

$feed = Profile::where('username', 'profilename')->first()->feed(100);

$schedule->call(function() { Profile::where('username', 'profilename')->first()->refreshFeed(100); })->twiceDaily();

Am i doing something wrong?

Media Expired (URL signature expired) & Refresh Throws http 400 error

Hi

I have just logged into one of my projects and i am receiving this error:

Http request to https://graph.instagram.com/5069349379818774/media?fields=caption,id,media_type,media_url,thumbnail_url,permalink,children{media_type,media_url},timestamp&limit=20&access_token=MYACCESS TOKEN failed with a status of 400 and error message: unknown error

The error points to this part of my code:

$ThisFeed = $profile?->refreshFeed(21);

I remove the code above and then i receive no images, i open the image in a new tab and receive 'URL signature expired' which points to the Instagram CDN image expiring.

Ive added a refresh back in like below:

$feed = \Dymantic\InstagramFeed\InstagramFeed::for('some_account', 21)->refresh()->collect();

However i get the original error which points to this line of code.

Undefined index: media_url

Hello!

2 days ago, there was a problem in the logs and in the email notification when the data was updated (I am using version 2.6):

[2021-11-09 11:12:16] local.ERROR: Undefined index: media_url {"exception":"[object] (ErrorException(code: 0): Undefined index: media_url at /srv/www/goldenblues/vendor/dymantic/laravel-instagram-feed/src/MediaParser.php:90)

update error

Hello! When updating i get this error:

{ "error": { "message": "Syntax error \"Expected \"(\" instead of \",\".\" at character 75: caption,id,media_type,media_url,thumbnail_url,permalink,children.media_type,children.media_url,timestamp", "type": "IGApiException", "code": 2500, "fbtrace_id": "AGDh0xebtg5Q1zRB8TaOlBd" } }

Could not resolve host: graph.instagram.com

I have had this package on my site for a while now and recently I get this error every now and then. It has resolved it self in the past but it also crashes my site when the error occurs so I am just wondering why. Not sure if its on my end, the package or Instagrams

cURL error 6: Could not resolve host: graph.instagram.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

Laravel 9 Support?

Tried to install on Laravel 9.0.1, PHP 8.1.2

Problem 1 - Root composer.json requires dymantic/laravel-instagram-feed ^3.0 -> satisfiable by dymantic/laravel-instagram-feed[v3.0.0]. - dymantic/laravel-instagram-feed v3.0.0 requires illuminate/config ^7.0 | ^8.0 -> found illuminate/config[v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.

How can we access the pagination function??

while ($this->shouldFetchNextPage($response, $collection->count(), $limit)) { $response = $this->fetchResponseData($response['paging']['next']); $collection = $collection->merge($response['data']) ->reject(function ($media) { return $this->ignoreVideo($media); }); }

Hi, When I call a var_dump or {{dd($x)}} the ['paging']['next'] is not in the array.

Problem with getting access token

I get this message right after click on allow.

Client error: POST https://api.instagram.com/oauth/access_token resulted in a 400 Bad Request response: {"error_type": "OAuthException", "code": 400, "error_message": "Error validating verification code. Please make sure you (truncated...)

image

image

Can you please update the guzzlehttp/guzzle

I get an error in installation saying dymantic/laravel-instagram-feed v2.3.1 requires guzzlehttp/guzzle ^6.5

I have a project using laravel 8 and "guzzlehttp/guzzle": "^7.0.1"

Can you please update the dependency

Trying to get property 'email' of non-object

If the following command fails: php artisan instagram-feed:refresh

The following error is generated:
ErrorException
Trying to get property 'email' of non-object

This would be because the following variable does not exist in the default config: 'notify_on_error'.

An email should only be attempted if this variable is set. Additionally, this variable should exist by default in the config, but with the default set to NULL.

Carousel_Album

Hi,

Great package - saved me a load of headaches so far!

I just have a query about the carousel item types - is it possible to enable those in full? The docs state that the first item is used, and they seem to be returned as "image" types. However, I noticed the media fields constant includes the "Children" field. It would be great to be able to pull out the data from the feed.

I know I can send a request myself to get that data, but just wondering if there's a method for calling that already within the package to reduce the number of calls etc and take advantage of the package's existing caching.

Many thanks!

Instagram refresh command - specify feed items

Before I start, this is a request which I could put a PR in or leave up to you to determine whether to add it or not.

When refreshing a profiles feed using the refresh feed method, you can optionally choose a number of items $profile->refreshFeed(10) for example. The refresh command currently cycles through all profiles and refreshes by the default number which is 20. I propose adding an optional input to the refresh command {feedItems?} to use as the refresh feed item quantity.

Let me know what you think.

Question : how to debug the failure ?

Sorry to ask again but, I did make it work correctly on my local computer.

I did deploy it on my distant server, and added the correct Callback URI into the Facebook / Instagram App. There's no error on the Instagram authentication process side, but I get a failure on the callback each time... even I did set it up exactly the same way as I did on the local development environment ...

With only my failure as a return, how can I debug? Thanks.

Overwritable credentials using state ID

Initially I created a profile using the artisan command supplied.

So now I have Profile::find(1); available to me

I then created the link as below, obfuscated the real data of course but left the structure:

https://api.instagram.com/oauth/authorize/?client_id=1234567890&redirect_uri=https://site.com/instagram/auth/callback&scope=user_profile,user_media&response_type=code&state=1

state=1 at the end is the user ID from what I can see. I can follow this link as a different user and authorise against that id.

Data stored in feed tokens is not the same username as the one on the profiles table but is linked to the profile ID in the profile table.

So now when I call $profile->feed() I get the feed for the profile I just authorised and not the username that's stored in the profile table.

Suggested solution would be to check the username returned is the same as the one that state id is expecting, otherwise create the profile line and give it a new ID OR throw an error and not accept the account.

Client error: `GET https://graph.instagram.com/{USER ID}/media?fields=like_count,caption,id,media...

Client error: GET https://graph.instagram.com/3730017507122069/media?fields=like_count,caption,id,media_type,media_url,thumbnail_url,permalink,children%7Bmedia_type,media_url%7D,timestamp&limit=100&access_token={TOKEN}.

resulted in a 403 Forbidden response:
{"error":{"message":"Application does not have permission for this action","type":"IGApiException","code":10,"fbtrace_id (truncated...)

If you uncheck media permission when connecting to Instagram, but confirm the connection anyway. You are met with this error. Any ideas how to resolve it?

Feed Returning A Profile Object Only - Laravel 8 & Vue

Hi

I now have the account all connected and working after upgrading to Laravel 8.

I am fully connected and can see the profile pulling in correctly and the feed items.

My Controller:

$feed = \Dymantic\InstagramFeed\InstagramFeed::for('insta_profile');

return Jetstream::inertia()->render($request, 'PortfolioSummary', [ 'instagram_feed' => $feed ]);

if a dd($feed) it returns the profile and items.

However in the Vue file i can only access the $feed as an Object and only the Profile as an Object.

Cannot feed by tinker - Laravel 9

Hi after i verified all i wanted to feed some images from instagram, but when i try to do it by "$profile->refreshFeed()" or "$profile->Feed(4)" tinker return to me

>>> $profile->refreshFeed()
=> Dymantic\InstagramFeed\InstagramFeed {#3716
     +profile: Dymantic\InstagramFeed\Profile {#3705
       id: 2,
       username: "myname",
       identity_token: "mytoken",
       created_at: "2022-04-11 14:25:09",
       updated_at: "2022-04-11 14:29:10",
     },
   }

Show instagram feed

Hello,

Thank you in advance for your assistance,
Thanks for your plugin

I have a problem when I want to display the Instagram feed I added the profile, the token, everything, and authorize but when displaying the foreach I get the following error

Cannot use object of type Dymantic \ InstagramFeed \ InstagramMedia as array

my sight :
$feed = \Dymantic\InstagramFeed\Profile::where('username', 'myaccount')->first()->feed($limit = 10);

my controller:
return view('frontend.index', compact('categories'))->with(['instagram' => $feed]);

thank you for your help

How to get feed without adding users as app testers

Hi Michael its me again sorry to bug you.

Do we need to always add users as app testers in facebook developers ? to get the feeds.
I switched my facebook app to live mode but when I logged in instagram using a non tester account
it returned error code 400 invalid scope.

instagram-feed:refresh-token issue

When running the refresh token command throws an error due to user changing permissions/password.

image

Can we have it so that it checks if the access token is valid. Or even wrap this function in a try catch?
image

Thanks

Empty array on $profile->feed()

Hello,

I am getting an empty array on $profile->feed(), I am using Laravel 8.

I followed the provided tutorial step by step, everything is perfect without error. the application got allowed with the link and successfully redirected to the provided callback URL, and the token has been generated. But when I try to fetch data with the feed method, I get an empty array without any error.

Force Instagram Re-authentication

Hi Michael good day its me again.

Would like to know if its possible for instagram re-authentication when
fetching basic display data?

currently after first successful instagram feed acquisition the account remains logged in instagram
and when I try to fetch a different account feed I need to log out first from instagram with the previous account
before fetching new instagram account feed

Token Refresh Cron Instructions not refreshing Token

I have created the token refresh cron as per the guide.

However the token does not refresh and i get an outtage every 60 days.

I have the below in app/console/Kernel.php

protected function schedule(Schedule $schedule) { $schedule->command('instagram-feed:refresh-tokens')->monthly(); }

Laravel 8 - Class "Dymantic\InstagramFeed\InstagramFeed" not found

Hi

Just installed the package, published the vendor files, updated the config and migrated the migrations to the database. All worked fine. Can see the package in the vendor folder. However i am getting the error - Class "Dymantic\InstagramFeed\InstagramFeed" not found

$feed = \Dymantic\InstagramFeed\InstagramFeed::for('my_profile');

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.