【问题标题】:Instaloader download_profiles with post_filter example?Instaloader download_profiles 与 post_filter 示例?
【发布时间】:2021-10-16 03:37:34
【问题描述】:

我正在尝试下载包含某个日期之后的帖子的个人资料作为测试。我有简单的代码:

L = instaloader.Instaloader(save_metadata=False, download_comments=False)
L.download_profiles(Profiles, posts=True, fast_update=True, post_filter="date_utc >= datetime(2019, 1, 1)")

没有post_filter 可以正常工作,但是使用post_filter,我得到:

<Post BOJaRXwhIix> skipped. Filter evaluation failed: 'str' object is not callable
<Post BOJZ6nqhpkX> skipped. Filter evaluation failed: 'str' object is not callable
<Post BHDC70ShoOs> skipped. Filter evaluation failed: 'str' object is not callable

我想我遗漏了一些明显的东西,但是文档说post_filter 字符串应该是 Python 合法的布尔语句,我直接从command-line filter example in the docs 获得了这个示例。建议?

【问题讨论】:

    标签: instaloader


    【解决方案1】:
    L.download_profiles(Profiles, posts=True, fast_update=True, post_filter=lambda post: post.date_utc >= datetime(2019, 1, 1))
    

    【讨论】:

    • 欢迎来到 Stack Overflow。请阅读How to Answer。一般来说,转储代码不如包含代码和解释的答案有用。
    猜你喜欢
    • 2016-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多