1. 개요

인스타그램 API이다.


2. 다운로드

https://github.com/LevPasha/Instagram-API-python


3. 설치 방법

(Git페이지에서 인용함)

  1. Fork/Clone/Download this repo

    git clone https://github.com/LevPasha/Instagram-API-python.git

  2. Navigate to the directory

    cd Instagram-API-python

  3. Install the dependencies

    pip install -r requirements.txt

  4. Modify test.py with your own username and password

  5. Run the test script (use text editor to edit the script and type in valid Instagram username/password)

    python test.py


4. 의존성 설치

(위 3-3에 해당됨)

Collecting requests==2.11.1 (from -r requirements.txt (line 1))
  Downloading requests-2.11.1-py2.py3-none-any.whl (514kB)
    100% |████████████████████████████████| 522kB 337kB/s
Collecting requests-toolbelt==0.7.0 (from -r requirements.txt (line 2))
  Downloading requests_toolbelt-0.7.0-py2.py3-none-any.whl (52kB)
    100% |████████████████████████████████| 61kB 988kB/s
Collecting moviepy==0.2.2.11 (from -r requirements.txt (line 3))
  Downloading moviepy-0.2.2.11.tar.gz (107kB)
    100% |████████████████████████████████| 112kB 382kB/s
Collecting numpy (from moviepy==0.2.2.11->-r requirements.txt (line 3))
  Downloading numpy-1.13.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.5MB)
    100% |████████████████████████████████| 4.6MB 150kB/s
Collecting decorator (from moviepy==0.2.2.11->-r requirements.txt (line 3))
  Downloading decorator-4.1.2-py2.py3-none-any.whl
Collecting imageio (from moviepy==0.2.2.11->-r requirements.txt (line 3))
  Downloading imageio-2.2.0.tar.gz (3.3MB)
    100% |████████████████████████████████| 3.3MB 170kB/s
Collecting tqdm (from moviepy==0.2.2.11->-r requirements.txt (line 3))
  Downloading tqdm-4.15.0-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 1.3MB/s
Collecting pillow (from imageio->moviepy==0.2.2.11->-r requirements.txt (line 3))
  Downloading Pillow-4.2.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.5MB)
    100% |████████████████████████████████| 3.5MB 114kB/s
Collecting olefile (from pillow->imageio->moviepy==0.2.2.11->-r requirements.txt (line 3))
  Downloading olefile-0.44.zip (74kB)
    100% |████████████████████████████████| 81kB 281kB/s
Installing collected packages: requests, requests-toolbelt, numpy, decorator, olefile, pillow, imageio, tqdm, moviepy
  Running setup.py install for olefile ... done
  Running setup.py install for imageio ... done
  Running setup.py install for moviepy ... done
Successfully installed decorator-4.1.2 imageio-2.2.0 moviepy-0.2.2.11 numpy-1.13.1 olefile-0.44 pillow-4.2.1 requests-2.11.1 requests-toolbelt-0.7.0 tqdm-4.15.0

5. 오류

5-1. imageio.core.fetching.NeedDownloadError

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 99, in get_exe
    auto=False)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/imageio/core/fetching.py", line 102, in get_remote_file
    raise NeedDownloadError()
imageio.core.fetching.NeedDownloadError

imageio.core.fetching.NeedDownloadError: Need ffmpeg exe. You can obtain it with either:
  - install using conda: conda install ffmpeg -c conda-forge
  - download by calling: imageio.plugins.ffmpeg.download()

해결책은 다음과 같다. 

brew install ffmpeg

실행 예제이다.

==> Installing dependencies for ffmpeg: lame, x264, xvid
==> Installing ffmpeg dependency: lame
==> Downloading https://homebrew.bintray.com/bottles/lame-3.99.5.sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring lame-3.99.5.sierra.bottle.1.tar.gz
?  /usr/local/Cellar/lame/3.99.5: 26 files, 2MB
==> Installing ffmpeg dependency: x264
==> Downloading https://homebrew.bintray.com/bottles/x264-r2795.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring x264-r2795.sierra.bottle.tar.gz
?  /usr/local/Cellar/x264/r2795: 11 files, 3.2MB
==> Installing ffmpeg dependency: xvid
==> Downloading https://homebrew.bintray.com/bottles/xvid-1.3.4.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring xvid-1.3.4.sierra.bottle.tar.gz
?  /usr/local/Cellar/xvid/1.3.4: 9 files, 1.2MB
==> Installing ffmpeg
==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.3.4.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring ffmpeg-3.3.4.sierra.bottle.tar.gz
?  /usr/local/Cellar/ffmpeg/3.3.4: 243 files, 50.8MB

5-2. NameError: name 'system' is not defined

Traceback (most recent call last):
  File "foll.py", line 20, in 
    api.getSelfUsersFollowing()
  File "/apis/Instagram-API-python-master/InstagramAPI/InstagramAPI.py", line 554, in getSelfUsersFollowing
    return self.getUserFollowings(self.username_id)
  File "/apis/Instagram-API-python-master/InstagramAPI/InstagramAPI.py", line 546, in getUserFollowings
    if system.version_info.major == 3:
NameError: name 'system' is not defined

해결책은 InstagramAPI.py 파일의 546라인을 수정한다.

5-2-1. 수정전

if system.version_info.major == 3:

5-2-1. 수정후

if sys.version_info.major == 3: