Git Product home page Git Product logo

react-instafeed's Introduction

🖼️ react-instafeed

Greenkeeper badge Build Status NPM version

A dead simple way to get data from Instagram (inspired by Instafeed.js)

An Instagram friendly API URL and/or the data it returns. No {{templating}}.

🎁️ My suggestion is to use the buildUrl function with your options and fetch however you see fit.

😑️ If you do not want to do that, then you can use the default in this package (isomorphic-unfetch).

🤷️ And if you really don't want to do anything with the code, feel free to use react-instafeed which wraps this for react.

🚨️ You do not need this. 🚨️

⚠️ This is a direct port from instafeed-lite at the moment ⚠️

If you want assistance in creating the API URL you can use instafeed-lite.

The templating that this had should be handled by you after you grab your data.

I do not use this repo, but I did not want to delete it as other people do.

🚨️ Instagram is shutting down its current API in 2020. 🚨️

Read more here. Instagram Graph API is their new solution, which right now only is enabled for Business Accounts.

Support for Non-Business Profiles [FUTURE]: Basic permissioning for non-business profiles will be supported in early 2019.

Currently we are still using the v1 endpoints. (No real plan to move to Graph until Non-Business Profiles are ready.)

👩‍💻️ Install:

yarn add react-instafeed

Render

Options:

const options = {
  accessToken: 'access...',
  clientId: 'client...',
  get: 'user', // popular, user
  locationId: null,
  resolution: 'standard_resolution', // thumbnail, low_resolution, standard_resolution
  sortBy: 'none', // none, least-commented, least-liked, least-recent, most-commented, most-liked, most-recent, random
  tagName: null,
  userId: 123,
}

REACT:

import React, { Fragment } from 'react'
import { buildUrl } from 'react-instafeed'

// 🔥️ These are in your code (not this repo)
import useAbortableFetch from '@hooks/useAbortableFetch'
import Image from '@components/Image'

const Instagram = () => {
  const { json, loading, error, abort } = useAbortableFetch(buildUrl(options))
  if (loading) return 'Loading...'
  if (error) return `Error: ${error}`
  if (!json) return null

  const { data, meta, pagination } = json

  return (
    <Fragment>
      {// eslint-disable-next-line no-unused-vars
      data &&
        data.map(({ caption, id, images, tags }, index) => {
          const image = images[options.resolution]
          return (
              <Image
                key={index}
                url={image.url}
                title={caption.text}
                caption={caption.text}
                width={image.width}
                height={image.height}
              />
            </div>
          )
        })}
    </Fragment>
  )
}

URL:

import { buildUrl } from 'react-instafeed'

const instagramUrl = buildUrl(options)

Data:

import instafeed from 'react-instafeed'

const data = instafeed(options)

📓️ Notes:

Again, just use buildUrl and handle your own loading.

Variables

  • limit - Maximum number of Images to add. (max: 60)
  • resolution - Size of the images to get. Available options are:
    • low_resolution - 320x320
    • standard_resolution - 640x640
    • thumbnail (default) - 150x150
  • sortBy - Sort the images in a set order. Available options are:
    • least-commented - Lowest # of comments to highest.
    • least-liked - Lowest # likes to highest.
    • least-recent - Oldest to newest.
    • most-commented - Highest # of comments to lowest.
    • most-liked - Highest # of likes to lowest.
    • most-recent - Newest to oldest.
    • none (default) - As they come from Instagram.
    • random - Random order.

Further Documentation

🙌 Props

Super props to the Instafeed, Instagram, and React teams.

❤️ "Legal"

This software is provided as-is, and all that usually lovely stuff.

react-instafeed's People

Contributors

greenkeeper[bot] avatar jeromefitz 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

Watchers

 avatar  avatar

react-instafeed's Issues

PR coming soon for redesign based on HOC pattern

Hey @JeromeFitz,

My name is Casey Baggz and I'm good friends with Schobert (we used to work together). I was actually going to build this component but saw you've already started the process. After trying to use it, I actually needed more functionality out of it so I decided to do an upgrade to make this tool similar to others in the React community by creating a HOC.

I'm halfway through but wanted to give you a heads up that I'll be submitting a PR soon with updated docs, etc. At a high level, it's moving to the same pattern that react-redux, react-refetch, etc. are using by providing a HOC function where you pass in your presentational component in the return. This will allow users to access the pure data and not have to force a non-JSX route regarding templates.

You can check out the initial README here: https://github.com/caseybaggz/react-instafeed

I've also upgraded the suite to include more tools that are common in today's React open-source projects: storybook and Jest with Enzyme.

I think I might be done by the EOW and we can reconvene then.

Is there a way to get more images? Or just get 20 images with a certain tag?

I only need a certain amount (lets say 10) images with the tag '#sophievanduivenboden'. But because of the 20 limit of the images (which are the first 20 image of my instagram and not all of the images have that tag) I only get for example 5 images. Do you have a solution for that? That would be great!

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Uncaught Error: Missing clientId or accessToken.

I have added a clientId or accessToken but still not working. Every time I try to refresh my browser this two error message pop up in the console

warning.js:36 Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
instafeed.js:42 Uncaught Error: Missing clientId or accessToken.
    at Instafeed.run (instafeed.js:42)
    at InstafeedComponent.render (index.js:52)
    at ReactCompositeComponent.js:796
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:795)
    at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:822)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:362)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:258)
    at Object.mountComponent (ReactReconciler.js:46)
    at ReactDOMComponent.mountChildren (ReactMultiChild.js:238)

[testing] Automated Testing

With 🌲️ GreenKeeper and ⛑️ Travis CI being implemented, we are going to finally add in some automated testing (🤖️ > 💪️) so that we know we are breaking anything with builds.

Most likely we'll implement 🃏️ jest, and will need to add the 📏️ eslint to the party. 🎉️

Uncaught Error: Error from Instagram: The access_token provided is invalid.

I have found another error message access_token provided is invalid. I have looked and saw that Instagram changed their API on June 1, 2013, and didn't update their repo in instafeed.js.

instafeed.js:81 Uncaught Error: Error from Instagram: The access_token provided is invalid.
    at Instafeed.parse (instafeed.js:81)
    at recent?access_token=7605dba…&count=1&callback=instafeedCache1cab7d4b14b1467…:1

Is this still supported? What is the clientId?

I have an App ID and a token now, but I see no reference to clientId anywhere in the instagram documentation. Also is there an example of this using fetch without a 3rd party fetch library? I've tried useAbortableFetch and I just get back an html page with "Page Not Found".

How to pass onClick event for each image in gallery

Hello
I am using react-instafeed in my project for showing instagram gallery.I want to show a popup with image when any particular image is clicked from the gallery.How can i do that with react-instafeed?
Here is the screenshot of the gallery which i have implemented.
image

Profile page layout concern (responsive?)

When I view the profile page on my macbook air I see the company overview on the left hand side and Why Work with us is directly below the overview. It looks like its going into responsive mode. The Why Work with us and Company Perks etc should be showing on the right hand side. Maybe the responsive settings are off? I would expect this behavior on my phone but not on my macbook air?

The images are repeated several times

Hello, I add this in my code and the images are repeated many times so add a limit.

`<Instafeed

limit='2'

resolution='standard_resolution'

get='user'

userId='xxxxxxxx'

sortBy='none'

clientId='xxxxxxxxxx'

accessToken='xxxxxxxxxxxxxxx'

template='<div class="instafeed-item">
                     <a href="{{link}}" target="_blank">
                        <img class="col-lg-6 col-xs-12" src="{{image}}" />
                     </a>
               </div>'

/>`

Instagram API limit

Hey guys! How are you?
A question, maybe off-topic, but with some relation with the lib. Currently, the Instagram API has a limit of 500 requests per hour. I was thinking if there is a way we can cache locally the current picture or if there is another way to avoid multiple requests for the same picture.
As I said, this issue is more about getting new ideas than about a lib problem.

After github deployment, `Minified React error #254` in GatsbyJS blog. What should I do?

Error: Minified React error #254; visit https://reactjs.org/docs/error-decoder.html?invariant=254&args[]=instafeed for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
    at react-dom.production.min.js:13
    at a (react-dom.production.min.js:14)
    at jo (react-dom.production.min.js:134)
    at react-dom.production.min.js:144
    at qo (react-dom.production.min.js:148)
    at ti (react-dom.production.min.js:163)
    at Ri (react-dom.production.min.js:192)
    at ji (react-dom.production.min.js:193)
    at fa (react-dom.production.min.js:205)
    at sa (react-dom.production.min.js:204)
ai @ react-dom.production.min.js:171
r.function.r.componentDidCatch.n.callback @ react-dom.production.min.js:180
oo @ react-dom.production.min.js:125
ro @ react-dom.production.min.js:125
da @ react-dom.production.min.js:214
fa @ react-dom.production.min.js:205
sa @ react-dom.production.min.js:204
Mi @ react-dom.production.min.js:200
enqueueSetState @ react-dom.production.min.js:130
y.setState @ react.production.min.js:13
(anonymous) @ index.js:104
requestAnimationFrame (async)
(anonymous) @ index.js:102
Promise.then (async)
(anonymous) @ index.js:100
(anonymous) @ history.js:70
navigate @ history.js:69
(anonymous) @ navigation.js:101
Promise.then (async)
C @ navigation.js:91
window.___navigate @ navigation.js:147
g @ index.js:188
onClick @ index.js:164
onClick @ index.js:464
(anonymous) @ react-dom.production.min.js:14
d @ react-dom.production.min.js:15
(anonymous) @ react-dom.production.min.js:15
S @ react-dom.production.min.js:17
C @ react-dom.production.min.js:18
R @ react-dom.production.min.js:18
E @ react-dom.production.min.js:18
L @ react-dom.production.min.js:21
kn @ react-dom.production.min.js:84
ma @ react-dom.production.min.js:216
De @ react-dom.production.min.js:39
Cn @ react-dom.production.min.js:86
ga @ react-dom.production.min.js:216
Pn @ react-dom.production.min.js:85
react-dom.production.min.js:171 Error: Minified React error #254; visit https://reactjs.org/docs/error-decoder.html?invariant=254&args[]=instafeed for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
    at react-dom.production.min.js:13
    at a (react-dom.production.min.js:14)
    at jo (react-dom.production.min.js:134)
    at react-dom.production.min.js:144
    at qo (react-dom.production.min.js:148)
    at ti (react-dom.production.min.js:163)
    at Ri (react-dom.production.min.js:192)
    at ji (react-dom.production.min.js:193)
    at fa (react-dom.production.min.js:205)
    at sa (react-dom.production.min.js:204)
ai @ react-dom.production.min.js:171
n.callback @ react-dom.production.min.js:179
oo @ react-dom.production.min.js:125
ro @ react-dom.production.min.js:125
da @ react-dom.production.min.js:214
fa @ react-dom.production.min.js:205
sa @ react-dom.production.min.js:204
Mi @ react-dom.production.min.js:200
enqueueSetState @ react-dom.production.min.js:130
y.setState @ react.production.min.js:13
(anonymous) @ index.js:104
requestAnimationFrame (async)
(anonymous) @ index.js:102
Promise.then (async)
(anonymous) @ index.js:100
(anonymous) @ history.js:70
navigate @ history.js:69
(anonymous) @ navigation.js:101
Promise.then (async)
C @ navigation.js:91
window.___navigate @ navigation.js:147
g @ index.js:188
onClick @ index.js:164
onClick @ index.js:464
(anonymous) @ react-dom.production.min.js:14
d @ react-dom.production.min.js:15
(anonymous) @ react-dom.production.min.js:15
S @ react-dom.production.min.js:17
C @ react-dom.production.min.js:18
R @ react-dom.production.min.js:18
E @ react-dom.production.min.js:18
L @ react-dom.production.min.js:21
kn @ react-dom.production.min.js:84
ma @ react-dom.production.min.js:216
De @ react-dom.production.min.js:39
Cn @ react-dom.production.min.js:86
ga @ react-dom.production.min.js:216
Pn @ react-dom.production.min.js:85
react-dom.production.min.js:13 Uncaught Error: Minified React error #254; visit https://reactjs.org/docs/error-decoder.html?invariant=254&args[]=instafeed for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
    at react-dom.production.min.js:13
    at a (react-dom.production.min.js:14)
    at jo (react-dom.production.min.js:134)
    at react-dom.production.min.js:144
    at qo (react-dom.production.min.js:148)
    at ti (react-dom.production.min.js:163)
    at Ri (react-dom.production.min.js:192)
    at ji (react-dom.production.min.js:193)
    at fa (react-dom.production.min.js:205)
    at sa (react-dom.production.min.js:204)

after deploying on my gitpage, it happens in specific page.
I found to need using the non-minified react but I dont know how to use that or write into my gatsbyjs.

in offline bundle, they aren't coming out! so, insta feeds shows up on the page very well.
However, it's happening when deploys on github page.

Please let me know if someone knows how to deal with this error!

Instafeed component renders multiple times

I have an Instafeed with 20 latest images on my home page. Everytime I hit the home button in the navbar, the component renders the 20 images once again, adding them to the ones already rendered.
What's the way to prevent this behavior either by cleaning the rendered images, or by preventing images to be fetched once again?
Thanks.

Advanced Callback Functions are not executed

Hi Guys,

i tried your react instafeed. It work's quite fine, except the advanced callback functions.

Following how im using it:

<InstaFeed userId={YBMA_ID} target={INSTAFEED} clientId={INSTA_ID} template={INSTA_TEMPLATE} success={this.loaded} before={() => console.log('Before')} resolution="low_resolution" accessToken={ACCESS_TOKEN} />

Both callbacks are not executed.

Any idea what causes the problem, or am i doing it wrong?

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

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.