Git Product home page Git Product logo

slownews's Introduction

slownews

A web app that aggregates top news during the last week from sites like reddit, Lobste.rs and Hacker News. Written in Haskell and using Reflex FRP (via Obelisk).

Running locally

Install obelisk and run:

ob run

Visit http://localhost:8000/

Deploying

To deploy to a remote (NixOS) server, use ob deploy (see Obelisk docs for details).

To create a release for running locally, run:

nix-build -A exe

and then to run that:

(cd result && ./backend -p 3001)

slownews's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slownews's Issues

Make the scheduler reliable

Broken http requests (like the one below) leads to the scheduler stop working. Probably need to handle the exceptions reliably.

backend: HttpExceptionRequest Request {
  host                 = "hn.algolia.com"
  port                 = 80
  secure               = False
  requestHeaders       = [("User-Agent","haskell wreq-0.5.1.0")]
  path                 = "/api/v1/search"
  queryString          = "?tags=story&filters=num_comments%3E2%20AND%20created_at_i%3E1514851200&hitsPerPage=3&query=%22haskell%22"
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 ResponseTimeout

Elm component refactoring

Refactor the Elm client to use a component model (like chronicle) before implementing upcoming client-side features.

  • Is there a builtin library/framework (more than start-app)?

Upgrade obelisk

ob thunk unpack .obelisk/impl
cd .obelisk/impl
git checkout develop && git pull
cd -
ob thunk pack .obelisk/impl

And then apply code changes necessary to use the new Obelisk. ob run should give the compilation errors for this.

Highlight recently added links

Sometimes a 3-day old link (it got popular suddenly?) would appear today. It makes sense to put this link at top, or highlight somehow in UI of its newness.

Handle timeouts in the Haskell backend

.. and other http errors. Just retry.

backend: HttpExceptionRequest Request {
  host                 = "www.reddit.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("User-Agent","haskell wreq-0.5.1.0")]
  path                 = "/r/zerocarb/top/.json"
  queryString          = "?sort=top&t=week&limit=3"
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (ConnectionFailure Network.Socket.getAddrInfo: does not exist (nodename nor servname provided, or not known))

SlowNews does not render without JavaScript

I disable JavaScript by default, and SlowNews seems to render everything in JS client-side.

Would it be possible to render things server-side at first? That would be likely much faster, as a bonus. :)

Weekly email of links

Interesting, I was just thinking about a slow news idea like this. In particular I thought it would be cool if I could get these kind of links emailed to me weekly. I understand that this may be way out of scope for your project but thought I'd mention it.

Request timeouts

Oct 05 21:58:23 slownews heroku/router:  at=error code=H12 desc="Request timeout" method=GET path="/data" host=slownews.ca request_id=d3b49ebe-bc3f-4469-b8af-074822153c83 fwd="207.102.213.120" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 

obviously Go is not enough. Go Elixir!

RSS feeds as source

Start by implementing RSS/Atom format.

Research how to aggregate weekly best links from the raw feed.

Twitter source

Would be nice to collect and display the top N tweets in the last week from a single, or a collection of, Twitter profile.

eg: create a collection of twitter profiles of French programmers like https://twitter.com/@ptit_fred and show top 10 tweets in last week.

Supervise HTTPoison requests

Restart them when they die. At the moment this brings the whole web process down.

Oct 10 16:35:22 slownews-trot heroku/router:  at=info method=GET path="/data" host=slownews-trot.herokuapp.com request_id=6a975b5b-d658-444c-845c-11d3e10b497e fwd="207.102.213.120" dyno=web.1 connect=6ms service=13ms status=200 bytes=7571 
Oct 10 16:35:24 slownews-trot app/web.1:  {"Kernel pid terminated",application_controller,"{application_start_failure,slownews,{{shutdown,{failed_to_start_child,'Elixir.Slownews.Crawler',{#{'__exception__' => true,'__struct__' => 'Elixir.HTTPoison.Error',id => nil,reason => timeout},[{'Elixir.Slownews.Site.Reddit.Client','request!',5,[{file,\"lib/slownews.site.reddit.ex\"},{line,21}]},{'Elixir.Slownews.Site.Slownews.Site.Reddit',fetch,1,[{file,\"lib/slownews.site.reddit.ex\"},{line,11}]},{'Elixir.Slownews.Crawler.Util',fetchAndStore,1,[{file,\"lib/slownews.crawler.ex\"},{line,58}]},{'Elixir.Enum','-map/2-fun-0-',3,[{file,\"lib/enum.ex\"},{line,1043}]},{'Elixir.Enum','-reduce/3-lists^foldl/2-0-',3,[{file,\"lib/enum.ex\"},{line,1385}]},{'Elixir.Enum',map,2,[{file,\"lib/enum.ex\"},{line,1043}]},{'Elixir.Slownews.Crawler',init,1,[{file,\"lib/slownews.crawler.ex\"},{line,28}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,306}]}]}}},{'Elixir.Slownews',start,[normal,[]]}}}"}  
Oct 10 16:35:26 slownews-trot app/web.1:  Crash dump was written to: erl_crash.dump  
Oct 10 16:35:26 slownews-trot app/web.1:  Kernel pid terminated (application_controller) ({application_start_failure,slownews,{{shutdown,{failed_to_start_child,'Elixir.Slownews.Crawler',{#{'__exception__' => true,'__struct__' => 'Elixir.HTT  

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.