instaloader模块的download_story item()方法中的目标参数

2024-04-19 13:26:28 发布

您现在位置:Python中文网/ 问答频道 /正文

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

他们在instaloader文档中写道:

下载故事项(项目、目标)

下载一个用户故事

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

target(Union[str,Path])–替换dirname_模式和filename_模式中的{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'

Tags: 项目inpygetdatedownloadlinedownloader