在twint或getoldtweets中按转发数量或喜欢的数量抓取时,是否可以过滤推文3?

问题描述

exports.createPages = async ({ graphql,actions }) => {
  const {
    data: {
      pageMetadata,pageData,}
  } = await graphql(`
    {
      pageMetadata: allProductsJson {
        nodes {
          slug
          metadata {
            title
            description
            image {
              publicURL
            }
            robots
          }
        }
      }

      pageData: allPageJson {
        pages: {
          slug
        }
      }
    }
  `

  // for each page
  pageData.pages.map(({ slug }) => {
    // select the metadata with the matching slug
    const { metadata } = pageMetadata.nodes.find(node => node.slug === slug)
    
    // create the page
    actions.createPage({
      path: `/${slug}/`,component: `./src/templates/page.jsx`,context: { 
        // pass both the slug and metadata as context
        slug,metadata,}
    })
  })
}

这段代码需要花费大量时间才能执行,并且使我获得10,600条推文,其中大多数没有任何价值。我只需要转发或喜欢大于阈值的推文。不幸的是,关于twint和getoldtweets3的文档非常少。请问有人对此有任何经验吗?

解决方法

试试这个代码

c.Lang = "en"
c.Search = "TSLA"
StartDate = "2019-10-01"
EndDate = "2019-10-10"
c.Since = StartDate
c.Until = EndDate
c.Filter_retweets = True 
c.Store_csv = True
c.min_likes = 5 

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...