mirror of
https://github.com/instaloader/instaloader.git
synced 2024-11-23 10:42:30 +01:00
Refactor Instaloader's methods into a class
This commit is contained in:
parent
52492456ed
commit
caf75a8135
@ -9,4 +9,4 @@ python:
|
||||
install:
|
||||
- pip install pylint requests
|
||||
script:
|
||||
- python3 -m pylint -r n -d bad-whitespace,bad-continuation,missing-docstring,multiple-imports,too-many-arguments,locally-disabled,line-too-long instaloader
|
||||
- python3 -m pylint -r n -d bad-whitespace,missing-docstring,too-many-arguments,locally-disabled,line-too-long,too-many-public-methods instaloader
|
||||
|
21
README.rst
21
README.rst
@ -136,11 +136,14 @@ their follower count, do
|
||||
|
||||
import instaloader
|
||||
|
||||
# login
|
||||
session = instaloader.get_logged_in_session(USERNAME)
|
||||
# Get instance
|
||||
loader = instaloader.Instaloader()
|
||||
|
||||
# get followees
|
||||
followees = instaloader.get_followees(PROFILE, session)
|
||||
# Login
|
||||
loader.interactive_login(USERNAME)
|
||||
|
||||
# Retrieve followees
|
||||
followees = loader.get_followees(PROFILE)
|
||||
for f in followees:
|
||||
print("%i\t%s\t%s" % (f['follower_count'], f['username'], f['full_name']))
|
||||
|
||||
@ -150,7 +153,7 @@ Then, you may download all pictures of all followees with
|
||||
|
||||
for f in followees:
|
||||
try:
|
||||
instaloader.download(f['username'], session)
|
||||
loader.download(f['username'])
|
||||
except instaloader.NonfatalException:
|
||||
pass
|
||||
|
||||
@ -158,7 +161,7 @@ You could also download your last 20 liked pics with
|
||||
|
||||
.. code:: python
|
||||
|
||||
instaloader.download_feed_pics(session, max_count=20, fast_update=True,
|
||||
oader.download_feed_pics(max_count=20, fast_update=True,
|
||||
filter_func=lambda node:
|
||||
not node["likes"]["viewer_has_liked"] if "likes" in node else not node["viewer_has_liked"])
|
||||
|
||||
@ -166,7 +169,7 @@ To download the last 20 pictures with hashtag #cat, do
|
||||
|
||||
.. code:: python
|
||||
|
||||
instaloader.download_hashtag('cat', session=instaloader.get_anonymous_session(), max_count=20)
|
||||
loader.download_hashtag('cat', max_count=20)
|
||||
|
||||
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
|
||||
@ -174,7 +177,7 @@ name, you may call
|
||||
|
||||
.. code:: python
|
||||
|
||||
instaloader.get_id_by_username(PROFILE_NAME)
|
||||
loader.get_id_by_username(PROFILE_NAME)
|
||||
|
||||
``get_followees()`` also returns unique IDs for all loaded followees. To
|
||||
get the current username of a profile, given this unique ID
|
||||
@ -182,4 +185,4 @@ get the current username of a profile, given this unique ID
|
||||
|
||||
.. code:: python
|
||||
|
||||
instaloader.get_username_by_id(session, followees[0]['id'])
|
||||
loader.get_username_by_id(followees[0]['id'])
|
||||
|
640
instaloader.py
640
instaloader.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user