instapy使用中 - 解決できない問題があります。
instapyを実行した際に以下のエラーが出てしまい...
初心者です。
コンピューターサイエンス入学前にPythonを習得しようと学び始めです。
助けていただきたいです。
よろしくお願いいたします。
ーーーーー
以下が実行した手順の詳細です。
-
デスクトップ上に新しいフォルダを作成し、その中にテキストドキュメントとして
instagram.py
を作成しました。 -
PowerShellを開き、
pip install instapy
を実行し、InstaPyをインストールしました。 -
Sublime Textを起動し、
.py
ファイルを開いた後、以下の「該当するソースコード」を入力して保存しました。 -
PowerShellを開き、
py instagram.py
を入力してエンターキーを押し、プログラムを実行しました。
発生している問題・エラー
Traceback (most recent call last):
File "C:\Users\****\OneDrive\デスクトップ\instagram\instagram.py", line 1, in <module>
from instapy import InstaPy
File "C:\Users\****\AppData\Local\Programs\Python\Python312\Lib\site-packages\instapy\__init__.py", line 6, in <module>
from .instapy import InstaPy
File "C:\Users\****\AppData\Local\Programs\Python\Python312\Lib\site-packages\instapy\instapy.py", line 34, in <module>
from .browser import close_browser, set_selenium_local_session
File "C:\Users\****\AppData\Local\Programs\Python\Python312\Lib\site-packages\instapy\browser.py", line 14, in <module>
from .util import interruption_handler
File "C:\Users\****\AppData\Local\Programs\Python\Python312\Lib\site-packages\instapy\util.py", line 27, in <module>
from emoji.unicode_codes import UNICODE_EMOJI
ImportError: cannot import name 'UNICODE_EMOJI' from 'emoji.unicode_codes' (C:\Users\****\AppData\Local\Programs\Python\Python312\Lib\site-packages\emoji\unicode_codes\__init__.py)
該当するソースコード
""" Quickstart script for InstaPy usage """
# imports
from instapy import InstaPy
from instapy import smart_run
# login credentials
insta_username = '' # <- enter username here
insta_password = '' # <- enter password here
# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=False)
with smart_run(session):
""" Activity flow """
# general settings
session.set_relationship_bounds(enabled=True,
delimit_by_numbers=True,
max_followers=4590,
min_followers=45,
min_following=77)
session.set_dont_include(["friend1", "friend2", "friend3"])
session.set_dont_like(["pizza", "#store"])
# activity
session.like_by_tags(["natgeo"], amount=10)
自分で試したこと
emoji パッケージのアップデート
pip install --upgrade emoji
ーーーー
instapy パッケージのアップデート:
pip install --upgrade instapy