【问题标题】:Anyone know of a way to use python to get an instagram post's url (not the url of the picture or video but the whole post)任何人都知道使用python获取instagram帖子网址的方法(不是图片或视频的网址,而是整个帖子的网址)
【发布时间】:2023-03-10 03:21:01
【问题描述】:

这里是非常新的编码器。我试着帮助某人获取 Instagram 帖子的数据(图片、用户名、标题和帖子的链接)。我目前正在使用 instaloader 下载图片并获取帖子的用户名和标题。我面临的问题是,instaloader 只给我图片的网址,而不是整个帖子的网址,谷歌搜索这个我发现大多数人都在提供获取图片网址的方法。有谁知道如何使用python(是否为instaloader)来获取instagram帖子的url?

【问题讨论】:

标签: python instagram instaloader


【解决方案1】:

要获取帖子的 url,您可以使用 instaloader 的 Post.shortcode 属性来构造它。 这应该有效:

import instaloader

USER = ""
PASSWORD = ""

L = instaloader.Instaloader()
L.login(USER, PASSWORD)

posts = L.get_feed_posts() # Get the user's feed
for post in posts:
    print(f"https://www.instagram.com/p/{post.shortcode}") # Print each post's url

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-18
    • 1970-01-01
    • 1970-01-01
    • 2013-07-27
    • 2013-07-16
    • 2016-04-06
    • 2013-01-20
    • 1970-01-01
    相关资源
    最近更新 更多