dongzhi9032 2015-03-02 06:42
浏览 15
已采纳

Twitter Cron Job,将推文保存到DB

I am making an admin panel where real times tweets will be displayed and after approval from administrator, only approved tweets will be shown on website, fetching part is done, I made a cron job so after every 1 hour my script will fetch latest tweets from twitter and save in DB. Question comes if my first batch is run and save in DB after 1 hour new results will come(Not sure if any new) or all new, but duplicate results will be saved on DB which I don't want to do. how to stop this duplicate tweets saving to DB after every 1 hour. I used php, mysql for this.

  • 写回答

1条回答 默认 最新

  • 普通网友 2015-03-02 06:58
    关注

    You can keep hash field in DB, which stands for function md5($author.$tweet.$datetime). When cron task begins to process, check every tweet from the list for matching record from DB by hash field.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序