Giter VIP home page Giter VIP logo

newswall's Introduction

newswall

A real-time newswall, getting data from twitter or weibo.

Description

一个实时的新闻墙,给定指定的话题获取新浪微博(或twitter)上对应话题的最新内容。
当微博(或twitter)上的内容更新后,新闻墙这边同步更新。

因为是要从新浪或Twitter服务器上获取数据,所以在服务端使用了apscheduler模块来进行计划任务,用间隔很短的时间向新浪服务器请求数据,然后对数据进行分析。

遗憾的是搞不到新浪和Twitter的API token,所以在数据请求方面有些问题,达不到“实时推送”的要求。因为不能用这两个服务器的API,所以退而求其次,使用新浪的普通搜索端口'http://s.weibo.com/wb/'。

这个端口对搜索频率有很大的限制,所以一定程度上来说,这个服务器并不是“实时”的。但若能够使用API,那直接切换便可以实时推送新浪的更新,也省去了对新浪那不规则的html进行分析了(泪目)。

前端使用了jQuery以及jQuerymasonry(瀑布流)插件。这个插件可以动态地对前端的新闻块儿进行排列,非常好看。

用户在首页输入想要跟踪的话题,后端便开始向新浪搜索接口请求数据,向scheduler添加请求函数,定时(理论上以非常短的间隔)向新浪请求数据,用NewsBuffer类分析请求到的html,通过hashlib.md5模块来筛选出最新且不重复的块儿,然后通过StatusHandler向前端推送。用JS捕获后端的response,然后动态地将其插入页面,用masonry重排版面,保证最新的消息在最前面显示。

newswall's People

Contributors

marcoqin avatar

Stargazers

Yuheng avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.