Giter VIP home page Giter VIP logo

django-instagram's People

Contributors

chicosilva avatar citmusa avatar devonwarren avatar dimkoug avatar fsouza avatar marcopompili 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-instagram's Issues

ERROR - path to profile media not found, stopped working in Production

Django Instagram was working, but now I receive the following error only in Production. In my development environment it works fine. It was working in production yesterday.

Traceback (most recent call last):
django_1    |   File "/usr/local/lib/python3.6/site-packages/django_instagram/templatetags/instagram_client.py", line 34, in get_profile_media
django_1    |     edges = profile['entry_data']['ProfilePage'][page]['graphql']['user']['edge_owner_to_timeline_media']['edges']
django_1    | KeyError: 'ProfilePage'

ImportError: No module named templatetags

I have downloaded and "python setup.py install" the package, added 'django_instagram' to the INSTALLED_APPS but receive a "ImportError: No module named templatetags" error when starting the server with "./manage.py runserver".

Admins-MacBook-Air-3:kahuna Administrator$ ./manage.py runserver
Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/core/management/init.py", line 354, in execute
django.setup()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/init.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/contrib/admin/init.py", line 23, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/Users/Administrator/anaconda/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/Users/Administrator/anaconda/lib/python2.7/site-packages/django_instagram-0.1-py2.7.egg/django_instagram/admin.py", line 15, in
ImportError: No module named templatetags

Instagram images not loading with caching enabled (403 error)

I enabled caching and then things broke - I could see there was a 403 error trying to fetch images from Instagram. It took me a while, but it turns out that sorl-thumbnail removes URL parameters by default, which breaks requests to Instagram (not sure if this is a change from the past).

To fix this you need to add this to your settings:

THUMBNAIL_REMOVE_URL_ARGS = False

requests.exceptions.HTTPError: 429 Client Error: - for url: https://www.instagram.com/accounts/login/

Hi,

I am using django-instagram client for first time. I am using django 3.2. I following the usage example but on console there are error, Here is the log:

ERROR:root:user profile "mr.nasir.hussain45" not found
Traceback (most recent call last):
File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/django_instagram/scraper.py", line 28, in instagram_scrap_profile
page.raise_for_status()
File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: - for url: https://www.instagram.com/accounts/login/
ERROR:root:scripts not found
Traceback (most recent call last):
File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/django_instagram/scraper.py", line 44, in instagram_profile_js
return tree.xpath('//script')
AttributeError: 'NoneType' object has no attribute 'xpath'

Note (mr.nasir.hussain45 is a public profile)

image could not be load in html

using a tutorial and any username with is public images do not appears

Captura de tela de 2020-01-05 08-57-23

and when i just open the same url into another the image appears without any problem

Media Url

The media url is wrong in example since Instagram has change his json structure.
Instead of using :

{{ media.display_src }}

Please use :

{{ media.shortcode }}

Full working example :

{% load instagram_client %}

{% instagram_user_recent_media intel %}

<div id="django_recent_media_wall">
  {% for media in recent_media %}
    <div class="django_instagram_media_wall_item">
      <a href="{{ media.shortcode }}" target="_blank" title="{{ media.caption }}">
        <img src="{{ media.thumbnail_src }}"/>
        <span>{{ media.caption }}</span>
      </a>
    </div>
  {% endfor %}
</div>

AttributeError: 'NoneType' object has no attribute 'xpath'

Hi, I had fetch all posts from Instagram normally but I don't know how now I get this error when start runserver.

Django==2.0.7

ERROR:root:user profile "rbrz" not found
Traceback (most recent call last):
  File "/Users/rbrz/.virtualenvs/epneus/lib/python3.6/site-packages/django_instagram/scraper.py", line 28, in instagram_scrap_profile
    page.raise_for_status()
  File "/Users/rbrz/.virtualenvs/epneus/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: No server is available for the request for url: https://www.instagram.com/encruzilhadapneus/
ERROR:root:scripts not found
Traceback (most recent call last):
  File "/Users/rbrz/.virtualenvs/epneus/lib/python3.6/site-packages/django_instagram/scraper.py", line 44, in instagram_profile_js
    return tree.xpath('//script')
AttributeError: 'NoneType' object has no attribute 'xpath'

Any suggestions?

Best.

Could not find any downloads that satisfy the requirement django-instagram

Hi,

I cannot install your module using pip. This is my traceback :

pip install django-instagram
Downloading/unpacking django-instagram
  Could not find any downloads that satisfy the requirement django-instagram
Cleaning up...
No distributions at all found for django-instagram
Storing debug log for failure in /home/zea/.pip/pip.log

Thank you :)

Using a context variable as input instead of a raw string.

I pass a variable to the template that I call username. It contains the username of the instagram user. When I try to do this for example :

<p>{{ username }}</p>. It works perfectly. It's displaying the good username.

But when I use the tag {% instagram_user_recent_media username %}, it takes username as a string. So the app search on Instagram with the username "username". Obviously it don't find anything. I also tried to do that : {% instagram_user_recent_media {{ username }} %}

Originally posted by @Abdullahabid3691 in #18 (comment)

As @Abdullahabid3691 made me notice, the tag {% instagram_user_recent_media %} only accepts raw strings. It would make more sense to use a context variable.

Instagram blocks content loading

So there seems to be an update that disallows crawled images from Instagram.
I get "content can load" even though the images appear in the browser normally.

Thanks

This has worked perfect to add to a small project I'm working on. Thanks for your efforts.

README.rst is out of date

The ReST version of the README (which appears on pypi) references an admin page that no longer exists, which is very confusing.

KeyError 'user"

Unexpectedly an application started to display the following error:

KeyError at /
'user'

[...] python2.7 / site-packages / django_instagram / templatetags / instagram_client.py in get_profile_media, line 23

[...] python2.7 / site-packages / django_instagram / templatetags / instagram_client.py in get_profile_media

return profile ['entry_data'] ['ProfilePage'] [page] ['user'] ['media'] ['nodes']

Anyone else with this issue?

Instagram feed either not loading or loading intermittently

Having a really strange issue that is only present on my website on the production server (everything seems to work fine in the dev server). I'm using Django 2.2.

The Instagram feed I'm trying to query doesn't display, or only displays intermittently (if I just keep refreshing the page sometimes the feed will display, and sometimes it won't). I'm not getting any errors in my gunicorn, django, or nginx error logs.

When I look at where the Instagram feed should be injected into the html using devtools there is an element of:
<div class="slick-track" role="listbox" style="opacity: 1; width: 0px; transform: translate3d(317px, 0px, 0px);"></div>

but nothing is inside it, and there isn't an empty div for each image URL pulled in so I know it's not even grabbing any URL's.

Here is my html for calling the Instagram client:

{% load instagram_client %}
	<div class="gallery-slider-2 z-index">
		<div class="gallery-active">
			{% instagram_user_recent_media "nm_asian_family_center" %}
			{% for media in recent_media %}
			<div class="gallery-slider-img {% if forloop.counter == 1 %}slick-current{%endif%}">
				<a href="//instagram.com/p/{{ media.shortcode }}" target="_blank">
					<img class="grow-insta" src="{{ media.thumbnail_src }}" alt=""></a>
			</div>
			{% endfor %}

		</div>
	</div>
</div>

Everything displays fine when I look at the site in my django dev server. I've only had these issues on my production server, and all other static files are loading fine. I'm guessing it might be some server configuration?

Any help or guidance is greatly appreciated!

EDIT
it's also worth noting that the package had been working fine on my production server just a few days ago. I made no changes to the site between when it was working fine and when I started having these issues.

django 1.8+ support

will this app work with django 1.8+? are you planning to update the support?

How to fetch all the posts from the instagram

Hi, I am using this package in my django project. And i want to know how can i fetch all the posts from instagram, as currently i am only able to fetch recent 12 posts. Thanks in advance.

plugin doesn't work

Hi Marco,
I following your instructions. All dependies installed. DB synchronized.
I copied and pasted code from "Usage" section. And I getting error:
Invalid block tag on line 5: 'instagram_user_recent_media'. Did you forget to register or load this tag?
What should I do now?

{% load staticfiles instagram_client %} breaks django-compressor

I'm trying to deploy my site to Heroku where I intend to use django-compressor on my CSS and Javascript files. I get the following messages when I run python manage.py compress.

Invalid template /usr/local/lib/python3.7/site-packages/django_instagram/templates/django_instagram/recent_media_wall.html: 'staticfiles' is not a registered tag library.

and

Invalid template /usr/local/lib/python3.7/site-packages/django_instagram/templates/django_instagram/recent_media_box.html: 'staticfiles' is not a registered tag library.

Is this related to Django 3.x removing {% load staticfiles %}? See this StackOverflow post for info.

Would {% load static instagram_client %} be the new, correct syntax?

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.