【问题标题】:Target parameter in the download_story item () method of the instaloader moduleinstaloader模块的download_story item()方法中的target参数
【发布时间】:2020-06-27 02:21:12
【问题描述】:

我正在制作一个应用程序来下载 Instagram 上的功能,并且我正在制作一个下载 Instagram 故事的功能

在他们编写的 instaloader 文档中:

download_storyitem(项目,目标)

下载一个用户故事。

参数 item (StoryItem) – 故事项目,如 get_stories() 中的 story['items'] 中的故事

target (Union[str, Path]) – 替换 dirname_pattern 和 filename_pattern 中的 {target}

这是我的代码:

def get_stories(self):
        get = root.get_stories(userids=6328186396)
        root.download_storyitem(get, ['file_name.jpg', "C:\Users"])

但这会产生错误:

Traceback (most recent call last):
  File "instagram_downloader.py", line 68, in <module>
    main()
  File "instagram_downloader.py", line 59, in main
    start.get_stories()
  File "instagram_downloader.py", line 21, in get_stories
    root.download_storyitem(get, ['file_name.jpg', "\Pictures"])
  File "C:\Users\codin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\instaloader\instaloader.py", line 631, in download_storyitem
    date_local = item.date_local
AttributeError: 'generator' object has no attribute 'date_local'

【问题讨论】:

    标签: python python-3.x instagram


    【解决方案1】:
    download_storyitem(item, '{}/{}'.format(highlight.owner_username, highlight.title))
    

    使用此代码

    【讨论】:

    • 请记住,Stack Overflow 不仅仅是为了解决眼前的问题,而是为了帮助未来的读者找到类似问题的解决方案,这需要了解底层代码。这对于我们社区的初学者和不熟悉语法的成员来说尤其重要。鉴于此,您能否edit 您的答案包括对您正在做什么的解释以及为什么您认为这是最好的方法?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-24
    • 1970-01-01
    相关资源
    最近更新 更多