Giter Club home page Giter Club logo

instagramfeed's Introduction

Javier Sanahuja

PHP Javascript HTML CSS WebRTC

Jsanahuja's github stats

instagramfeed's People

Contributors

evaleries avatar jsanahuja avatar n-shar-ma avatar petermorgandev avatar pustur avatar tavelli 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  avatar  avatar  avatar  avatar  avatar

instagramfeed's Issues

Enhancment proposal: reducing requests with some caching

Hey Thanks for that! It works perfectly. Had trouble with the api and looked for a solution to get some pics on a homepage.
To reduce requests on the instagram website a simple caching solution would be helpful (optional). I.e. saving the result in a file and have a time interval for refreshing that file.

Best regards, Roland

Filter tags?

Hey Javier,
is there a way to sort out hashtags? Like, I would like to see "#green" but I would like to exclude those pics, that have also been tagged with "#ecological"?

CORS policy workaround is inconsistent

The solution posted here works sometimes but is not consistent. I still get blocked by CORS errors sometimes, then I have to wait a while. Any advice to get this to work consistently? Or is it a request limit issue? I'm storing the retrieved posts in cookie so that I'm not making the request on every page load. But if new site visitors are going to get the CORS issue then this won't work out. Here's my options object:

 {
        'username': '<username>',
        'container': feedEntry,
        'display_profile': false,
        'display_biography': false,
        'display_gallery': true,
        'styling': false,
        'max_tries': 1,
        'callback': cacheFeed,
        'styling': true,
        'items': 5,
        'items_per_row': 5,
        'margin': 1,
        'lazy_load': true,
        'on_error': console.error,
        'host': "https://images" + ~~(Math.random() * 3333) + "-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/",
        'cache_time': 660
    }

Possible to get comments?

Not an actual issue, more of a question, would it be possible to get comments in the response? Also, what are the limits of this? How many requests before getting blocked?

Publish to npmjs and allow for import access

Hi there, this looks like an amazing project.

I'm trying to install this into my project via yarn but it doesn't look like you've published it to a npmjs site and created a tagged release. Would it be possible to do this?

Also, would it be possible to give us the ability to import the project instead of having have a hardcoded .js in the header?

This would enable a developer to do something like this:

<script>
import InstagramFeed from 'jsanahuja/InstagramFeed';

export default{
	mount(){
		InstagramFeed({
			'username': 'instagram',
			'container': document.getElementById("instagram-feed1"),
			'display_profile': true,
			'display_biography': true,
			'display_gallery': true,
			'callback': null,
			'styling': true,
			'items': 8,
			'items_per_row': 4,
			'margin': 1 
		});
	}
}
</script>

Profile and IGTV fetch results in 301 from Instagram

Hello, first of all I would like to appreciate the work that has been done by the author. Thank you for all your time and work.

I have spotted a tiny issue with the instagram URL for the profile and IGTV feed. While providing username, upon GET request, 301 HTTP status is returned from Instagram, where the location header presents the requested URL with slash / appended.

So:
https://instagram.com/instagram
results in 301 with location header:
https://instagram.com/instagram/.
Looking at the source code, I can see that this both affects profile feed and IGTV, while the tags URL is being built correctly.

The easy workaround is to add a trailing slash / to the username option.

I know this is not a big deal since 301 is strongly cached by the browser, but still.

Thank you and best regards.

Excluding tags?

I'm looking for an attribute, ex: no_tag, to exclude those tags from the feed. Is there such a functionality?

Mobile

Hi, is it possible to change the items and items per row if its mobile?

Max 12 images?

Hi there!

As an teacher, I want to give my students the opportunity to have a simple online portfolio combined with Instagram. I found your github, thanks for this!!

I changed a bit to make it easier for my first year students to understand the code.
Now I've got a problem, I only can place max 12 images. The standard was 8 images, I changed this to 100, but I've only got 12 max.

I didn't change anything in the JS.

Here is the HTML with the edits in it

https://www.imgdumper.nl/uploads9/5ea7ea67e846e/5ea7ea67e020f-Screenshot_2020-04-28_at_10.33.16.png

What am I missing?

InstagrafeedFeed don't working

Hello Everyone, I notice some issues through in this week. Images don't load on any .js files (jquery or without jquery). The cause, probably, come from instagram and your repeatedly updates.

Can u guys check?

Thx!

jQuery in JS only version docs

FYI, you have some jQuery in the JS version docs for example 7:

<script type="text/javascript" src="dist/InstagramFeed.min.js"></script>
<script type="text/javascript">
    (function(){
        new InstagramFeed({
            'username': 'instagram',
            'callback': function(data){
                $('#jsonHere').html(JSON.stringify(data, null, 2));
            }
        });
    })();
</script>

However, in your source you're using it correctly:

            new InstagramFeed({
                'username': 'instagram',
                'callback': function(data) {
                    document.getElementById("jsonHere").innerHTML = JSON.stringify(data, null, 2);
                }
            });

Just thought I'd let you know in case you wanted to update accordingly.

possibility to add sortBy option?

Would love the option to be able to pull specific posts instead of just the most recent. for example, only displaying the 3rd post.

Exclude movies from feed?

Right now InstagramFeed fetches all feed including movies from profiles, the problem is that movies are imported as black images with hrefs, which looks... weird.

Example:
feed

Any way to exclude videos?

Custom URLs

Would it be possible to assign custom (individual) URLs to posts?

Started getting `TypeError: undefined is not an object (evaluating 'a[1].split')` for specific username

I have tested, and other usernames and the demo website work, however when I use this with the username, 'blacklinesdrinks' (https://www.instagram.com/blacklinesdrinks/), I get the error TypeError: undefined is not an object (evaluating 'a[1].split') in the console.

I'm not sure what the issue could be, as this username was working at one point, and it doesn't appear to be a network ban as the demo website and other usernames still appear to be working.

Any help in getting this resolved would be greatly appreciated

ReferenceError: InstagramFeed is not defined

ReferenceError: InstagramFeed is not defined
https://vamsithota.me/photography2/:93
https://vamsithota.me/photography2/:105

Here's the code I have inserted in tag.
`<script src="https://cdn.jsdelivr.net/gh/jsanahuja/InstagramFeed/dist/InstagramFeed.min.js"></script>

<script> (function(){ new InstagramFeed({ 'username': 'instagram', 'container': document.getElementById("instagram-feed1"), 'display_profile': true, 'display_biography': true, 'display_gallery': true, 'callback': null, 'styling': true, 'items': 8, 'items_per_row': 4, 'margin': 1 }); })(); </script>`

Here's the code I have used in tag.
<div id="instagram-feed1"></div>

The Feed is not loading and throwing this error
image

How do I fix this issue?

Multiple hashtags

Hello, your library is pretty useful!
I have a question, is there any way to use multiple hashtags instead of just one?
Thank you

npm install not found

I tried the following but, I get the 404 error:

npm install @jsanahuja/[email protected]

https://github.com/jsanahuja/InstagramFeed/packages/120475

❯ npm install @jsanahuja/[email protected]
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@jsanahuja%2finstagramfeed - Not found
npm ERR! 404 
npm ERR! 404  '@jsanahuja/[email protected]' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/username/.npm/_logs/2020-09-03T17_09_50_891Z-debug.log

Is there an updated install method now that npm is part of Github, perhaps?

CORS policy error and temporary banned

Dear all,
I have some issues on this really useful library.
first of all I got the CORS Policy error:

Access to XMLHttpRequest at 'https://www.instagram.com/batman/' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

when I retried i got this other error:
InstagramFeed: It looks like YOUR network has been temporary banned because of too many requests. See jsanahuja/jquery.instagramFeed#25

Following the link jsanahuja/jquery.instagramFeed#25 i found the solution to other issues.

I have simply tested the application putting the following in my html:

<script src="/instagramfeed.min.js"></script> <script> (function(){ new InstagramFeed({ 'username': 'batman', 'container': document.getElementById("instagram"), 'display_profile': false, 'display_biography': false, 'display_gallery': true, 'display_captions': false, 'callback': null, 'styling': true, 'items': 8, 'items_per_row': 4, 'margin': 1 }); })(); </script>

is some error of my code? can I do something to solve this?
any suggestions?

Thank you very much
Cheers
R

How center

How to center all images in bootstrap card?

Safari ipad/iphone image size issue

On Safari Iphone/iPad the images in the grid are very tall, and are stretched.

I've fixed locally by changing the display: inline-flex; to display: inline-block; on the <a> elements

InstagramFeed stoped working

Hello good people, InstagramFeed stoped working on my site.

This is the error in console:

InstagramFeed: Unable to fetch the given user/tag. Instagram responded with the status code: No Reason Phrase 5

I am using curren version from master branch (minified).

This is my script:

<script>
    (function () {
        new InstagramFeed({
            'username': 'yogenabrno',
            'container': document.getElementById("insta1"),
            'display_profile': false,
            'display_biography': false,
            'display_gallery': true,
            'callback': null,
            'styling': true,
            'items': 4,
            'items_per_row': 4,
            'margin': 1,
            'image_size': 640
        });
    })();
</script>

Post Captions

Hey, i'm trying to find a way to get the img caption, however it doesn't look like its being pulled.
I'm have no clue how to add this myself, so im asking if its possible to do

checked, console.log( img[ i ] ); but cannot find a field which would represent the caption in any way.

node:
__typename: "GraphImage"
id: "2198312878692136426"
edge_media_to_caption: {edges: Array(1)}
shortcode: "B6B-ep_nHXq"
edge_media_to_comment: {count: 1}
comments_disabled: false
taken_at_timestamp: 1576279338
dimensions: {height: 1077, width: 1080}
display_url: "https://scontent-lht6-1.cdninstagram.com/v/t51.2885-15/e35/s1080x1080/75403225_204983533864953_2689988167004388606_n.jpg?_nc_ht=scontent-lht6-1.cdninstagram.com&_nc_cat=109&_nc_ohc=oNBmJmAPIwgAX-suKkn&oh=5212027434a0b365434dd26945746737&oe=5E796872"
edge_liked_by: {count: 45}
edge_media_preview_like: {count: 45}
location: null
gating_info: null
fact_check_overall_rating: null
fact_check_information: null
media_preview: "ACop5qirDCNkXbkSchh1z6MPT0I9s1EE9SBQK5OLGYx+aF+TGc9sVVq55jiMxb/kJyV7Zqttz0IP6UCTGUVOgRVbzM7sYQepPcn0A7dyRUNAyUEviNByxxx1J7UtxbSWzbJV2kjPY8fUZFWJrCe2mWL7zn5l2/5GMYqG6klkf9+TvXj5uCPbFIS0LS6cGi8zd1Qv935f90t2PB68ZwOpFUoIHuH8uMbmPOOB09zxSea4Ty9x2Hnbk4/LpTrbzPMHk58w8Db1/wA+vamMHLxExuOVOCD2qP5feuhitVt3CuVlu5c4DcqmRklvU/5HqazaBcZPKfmR/wCy0hLyJmWW1IvBMsxwAQepB7Dn/CromtNTTEoCOB3OGH+63cex/Kueu/8AWN9aq0ErVXFkADEIdygnB6ZHrVi0u3tSzR/eYY6dPf6/5NVTRTLsOMjM24kk9c98+uaDK5OSzEn3NMrsYP8AVr/uj+QpPQmT5eh//9k="
owner: {id: "1278618971", username: "watchitallabout"}
thumbnail_src: "https://scontent-lht6-1.cdninstagram.com/v/t51.2885-15/sh0.08/e35/c1.0.1280.1280a/s640x640/75403225_204983533864953_2689988167004388606_n.jpg?_nc_ht=scontent-lht6-1.cdninstagram.com&_nc_cat=109&_nc_ohc=oNBmJmAPIwgAX-suKkn&oh=0135f466cbc674c7bf05143b2637a0a2&oe=5E755E1C"
thumbnail_resources: (5) [{…}, {…}, {…}, {…}, {…}]
is_video: false
accessibility_caption: "Image may contain: night"

get tag from username

Get specific tag from username not working,

'username': 'instagram',
'tag': 'fathersday',

still showing all feed.

fyi: im still new at this

npm Doesn't work

Trying to import through npm using latest version and instructions in Wiki.... doesn't work.

FireFox CORS Error

I'm running into the error (Firefox only) "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at..."

I'm using a Plesk Server with nginx as reverse proxy and everything i tried isn't working...

Any Ideas?
Using jsonp instead of xhr?

Error Cross-Origin Read Blocking (CORB)

The CORS fix creates a new problem for me: Cross-Origin Read Blocking (CORB) blocked cross-origin response https://www.instagram.com/p/CL7rMUKDOaR/ with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.

Images don't display and have a URL like this instead: "https://lookaside.instagram.com/seo/google_widget/crawler/?media_id=2520798378721076881"

image

I just used the basic configuration with username: "google".

I added a callback to see the data received:

image

All urls start with "https://lookaside.instagram.com/seo/google_widget/crawler/".

I tried to enter the URL of the host in the browser: "https://images391-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/google" and "https://images391-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/google/p/CL7Iiq7ly55", I get an error: "your computer or network may be sending automated queries. To protect our users, we can't process your request right now."

image

I tried to reload the page on my phone in 4g (in case it's an ip ban), but I have the same error.

Code not working, what am I missing?

Hello! First I just wanted to say this library is genious. However I'm not currently able to execute it.
I have this code

const insta = document.createElement('div')
    insta.className = "instagram_feed box"
    insta.id = "instagram-feed-demo"
    insta.textContent = "Instagram pics go here"
    boxes.appendChild(insta)

    new InstagramFeed({
        username: 'myusername',
        container: "#instagram-feed-demo",
        display_profile: true,
        items: 10,
    });`

The div is displayed with the intended text but nothing else. What am I missing? Also no error on the console.

Request Error: No Data Retrieved...

I've just been working on a new site with this great script and have had the above/title error message in the console. The script also seems to have broken on other sites as well - and was working fine up until literally a few minutes ago... could Instagram have changed something?

Question - can I also query images galleries ?

This is awesome by the way!!!
Many thanks for the hard work ;)

Can this also get Instagram carousel images?

For example on img click send another request to see all the images on that gallery/carousel ?

I had this working and on the new API everything stopped working. :(

Awesome library

Hi, I just wanted to shout out, this is really cool project that saved me a lot of time!
Thank you so much!

Pagination

Hi! Great library - i love how simple api is!
I was wondering if it will be CORS compatible to load more items this way
Sorry if this is stupid idea, im not very familiar with fancy web programming 😔

load more than 12 images

Hi, great library!
just one small issue is missing .. to call the "load more" function, to get more than 12 results :)
.. but yes, I know, this JSON is not part of the pre-rendered HTML.
Any idea, how to do it?
Thank you

Video in feed kills script

Accounts which upload a video or have videos tend to stop or kills the script. Not loading. Even tried on the new version with changing only username in demo. Please help with this.

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.