hackernews: API for Hacker News

[ library, mit, program, web ] [ Propose Tags ] [ Report a vulnerability ]

API for news.ycombinator.com


[Skip to Readme]

Modules

[Last Documentation]

  • Web
    • Web.HackerNews
      • Web.HackerNews.Types

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.2.0.1, 0.2.1.1, 0.2.2.1, 0.2.2.2, 0.2.3.2, 0.3.0.0, 0.3.1.0, 0.3.1.1, 0.3.1.2, 0.4.0.0, 0.5.0.0, 0.5.0.1, 1.0.0.0, 1.1.0.0, 1.1.1.0, 1.1.2.0, 1.2.0.0, 1.3.0.0, 1.4.0.0
Dependencies aeson , attoparsec (>=0.13 && <0.14), base (<5), ghcjs-base , hackernews , hspec , hspec-core , http-client , http-client-tls , http-types (>=0.9), QuickCheck , quickcheck-instances , servant (>=0.9 && <0.13), servant-client (>=0.9 && <0.13), string-conversions (>=0.4 && <0.5), text (>=1.2 && <1.3) [details]
License MIT
Author David Johnson
Maintainer code@dmj.io
Uploaded by DavidJohnson at 2017年12月27日T17:45:59Z
Revised Revision 1 made by DavidJohnson at 2024年12月14日T02:17:37Z
Category Web
Source repo head: git clone https://github.com/dmjio/hackernews
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables ghcjs-tests, hackernews-example
Downloads 15315 total (59 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2017年12月27日 [all 3 reports]

Readme for hackernews-1.4.0.0

[back to package description]

hackernews

Hackage Hackage Dependencies Haskell Programming Language MIT License Build Status

Hacker News API for Haskell

Documentation

https://github.com/HackerNews/API

Now it supports GHCJS and can be used in the browser! Just install it using:

cabal install --ghcjs

Tests

cabal configure && cabal test
HackerNews API tests
 should round trip Updates JSON
 should round trip Item JSON
 should round trip User JSON
 should retrieve item
 should retrieve user
 should retrieve max item
 should retrieve top stories
 should retrieve new stories
 should retrieve best stories
 should retrieve ask stories
 should retrieve show stories
 should retrieve job stories
 should retrieve updates
 Finished in 1.2129 seconds
 13 examples, 0 failures

Usage

module Main where
import Network.HTTP.Client
import Network.HTTP.Client.TLS
import Web.HackerNews
main :: IO ()
main = do
 mgr <- newManager tlsManagerSettings
 print =<< getItem mgr (ItemId 1000)
 print =<< getUser mgr (UserId "dmjio")
 print =<< getMaxItem mgr
 print =<< getTopStories mgr
 print =<< getNewStories mgr
 print =<< getBestStories mgr
 print =<< getAskStories mgr
 print =<< getShowStories mgr
 print =<< getJobStories mgr
 print =<< getUpdates mgr
Right ( Item {
	 itemId = Just (ItemId 1000)
 , itemDeleted = Nothing
 , itemType = Story
 , itemBy = Just (UserName "python_kiss")
 , itemTime = Just (Time 1172394646)
 , itemText = Nothing
 , itemDead = Nothing
 , itemParent = Nothing
 , itemKids = Nothing
 , itemURL = Just (URL "http://www.netbusinessblog.com/2007/02/19/how-important-is-the-dot-com/")
 , itemScore = Just (Score 4)
 , itemTitle = Just (Title "How Important is the .com TLD?")
 , itemParts = Nothing
 , itemDescendants = Just (Descendants 0)
 })
Right (User {userId = UserId "dmjio"
		 , userDelay = Nothing
		 , userCreated = Created 1375807763
		 , userKarma = Karma 7
		 , userAbout = Nothing
		 , userSubmitted = Just (Submitted [11966297,9355613, ...])
		 })
Right (MaxItem 12695220)
Right (TopStories [12694004,12692190,12691597,...])
Right (NewStories [12695214,12695213,12695195,...])
Right (BestStories [12649414,12637126,12684980, ...])
Right (AskStories [12694706,12694401,12694038, ...])
Right (ShowStories [12694004,12692190,12695037, ...])
Right (JobStories [12693320,12691627,12690539,...])
Right (Updates { items = [12694916,12694478,12693674,..],
				 profiles = [UserName "stefano", UserName "chillydawg", ...]
			 })

AltStyle によって変換されたページ (->オリジナル) /