Documentation Enhancements
This commit is contained in:
@@ -1,26 +1,114 @@
|
||||
Usage as Python Module
|
||||
----------------------
|
||||
Python Module :mod:`instaloader`
|
||||
--------------------------------
|
||||
|
||||
Introduction
|
||||
^^^^^^^^^^^^
|
||||
.. module:: instaloader
|
||||
|
||||
.. include:: ../README.rst
|
||||
:start-after: as-module-intro-start
|
||||
:end-before: as-module-intro-end
|
||||
.. highlight:: python
|
||||
|
||||
You may also use parts of Instaloader as library to do other interesting
|
||||
things.
|
||||
|
||||
For example, to get a list of all followees and a list of all followers of a profile, do
|
||||
|
||||
.. code:: python
|
||||
|
||||
import instaloader
|
||||
|
||||
# Get instance
|
||||
loader = instaloader.Instaloader()
|
||||
|
||||
# Login
|
||||
loader.interactive_login(USERNAME)
|
||||
|
||||
# Print followees
|
||||
print(PROFILE + " follows these profiles:")
|
||||
for f in loader.get_followees(PROFILE):
|
||||
print("\t%s\t%s" % (f['username'], f['full_name']))
|
||||
|
||||
# Print followers
|
||||
print("Followers of " + PROFILE + ":")
|
||||
for f in loader.get_followers(PROFILE):
|
||||
print("\t%s\t%s" % (f['username'], f['full_name']))
|
||||
|
||||
Then, you may download all pictures of all followees with
|
||||
|
||||
.. code:: python
|
||||
|
||||
for f in loader.get_followees(PROFILE):
|
||||
loader.download_profile(f['username'])
|
||||
|
||||
You could also download your last 20 liked pics with
|
||||
|
||||
.. code:: python
|
||||
|
||||
loader.download_feed_posts(max_count=20, fast_update=True,
|
||||
filter_func=lambda post: post.viewer_has_liked)
|
||||
|
||||
To download the last 20 pictures with hashtag #cat, do
|
||||
|
||||
.. code:: python
|
||||
|
||||
loader.download_hashtag('cat', max_count=20)
|
||||
|
||||
Generally, :class:`Instaloader` provides methods to iterate over the Posts from
|
||||
a certain source.
|
||||
|
||||
.. code:: python
|
||||
|
||||
for post in loader.get_hashtag_posts('cat'):
|
||||
# post is an instance of instaloader.Post
|
||||
loader.download_post(post, target='#cat')
|
||||
|
||||
Each Instagram profile has its own unique ID which stays unmodified even
|
||||
if a user changes his/her username. To get said ID, given the profile's
|
||||
name, you may call
|
||||
|
||||
.. code:: python
|
||||
|
||||
loader.get_id_by_username(PROFILE_NAME)
|
||||
|
||||
|
||||
``Instaloader`` (Main Class)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: instaloader.Instaloader
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. _post-class:
|
||||
.. autoclass:: Instaloader
|
||||
:no-show-inheritance:
|
||||
|
||||
``Post`` Class
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: instaloader.Post
|
||||
:members:
|
||||
:undoc-members:
|
||||
.. autoclass:: Post
|
||||
:no-show-inheritance:
|
||||
|
||||
Miscellaneous Functions
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autofunction:: shortcode_to_mediaid
|
||||
|
||||
.. autofunction:: mediaid_to_shortcode
|
||||
|
||||
.. autoclass:: Tristate
|
||||
|
||||
Exceptions
|
||||
^^^^^^^^^^
|
||||
|
||||
.. autoexception:: InstaloaderException
|
||||
:no-show-inheritance:
|
||||
|
||||
.. autoexception:: QueryReturnedNotFoundException
|
||||
|
||||
.. autoexception:: ProfileNotExistsException
|
||||
|
||||
.. autoexception:: ProfileHasNoPicsException
|
||||
|
||||
.. autoexception:: PrivateProfileNotFollowedException
|
||||
|
||||
.. autoexception:: LoginRequiredException
|
||||
|
||||
.. autoexception:: InvalidArgumentException
|
||||
|
||||
.. autoexception:: BadResponseException
|
||||
|
||||
.. autoexception:: BadCredentialsException
|
||||
|
||||
.. autoexception:: ConnectionException
|
||||
|
Reference in New Issue
Block a user