要从Instagram URL获取所有Instagram节点,您可以使用以下方法:
Client ID
和Client Secret
。Client ID
和Client Secret
获取一个长期访问令牌。{user-id}
为Instagram用户的ID。requests
库):
import requests access_token = 'YOUR_ACCESS_TOKEN' user_id = 'USER_ID' url = f'https://graph.facebook.com/v13.0/{user_id}/media?access_token={access_token}' response = requests.get(url) data = response.json() for media in data['data']: print(media['id'])instaloader
)instaloader
库:
pip install instaloaderinstaloader
获取用户媒体:
import instaloader L = instaloader.Instaloader() profile = instaloader.Profile.from_username(L.context, 'username') for post in profile.get_posts(): print(post.mediaid)领取专属 10元无门槛券
手把手带您无忧上云