packages feed

gscholar-rss 0.2.3.1 → 0.2.4.0

raw patch · 4 files changed

+27/−11 lines, 4 files

Files

+ NEWS view
@@ -0,0 +1,4 @@+0.2.4.0+-------++- Add summary to <description> (requested by Ido Magal)
gscholar-rss.cabal view
@@ -1,9 +1,9 @@ name:                gscholar-rss-version:             0.2.3.1+version:             0.2.4.0 synopsis:            scrapes google scholar, provides RSS feed description:         A simple Google Scholar scraper, providing RSS/Atom                      feeds. Check <http://ariis.it/static/articles/gscholar-rss/page.html homepage>-                     for manual and examples.+                     for manual, binaries and examples. license:             GPL-3 license-file:        LICENSE author:              Francesco Ariis@@ -13,6 +13,7 @@ category:            Web, Utils build-type:          Simple extra-source-files:  README,+                     NEWS,                      manual/page.rst,                      manual/gscholar.jpg cabal-version:       2.0
manual/page.rst view
@@ -4,7 +4,7 @@ summary: Google Scholar to RSS feed scraper tags: google scholar, scholar, rss, feed, atom published: 2018-11-05 00:00:00-revised: 2018-11-10 00:00:00+revised: 2019-10-31 00:00:00 --------------------------------------------------------------------------------  ============@@ -28,10 +28,11 @@  - compile it yourself. This means getting Haskell for your platform   (e.g. on Debian ``sudo apt-get install haskell-platform``).-  Once you installed it:+  Once you have installed it:    :: +     cabal new-update      cabal get gscholar-rss      # now `cd` into the newly created folder and run      cabal new-build@@ -69,7 +70,7 @@ Many feed-readers allow taking advantage of external programs to fetch a feed; this is exactly what ``gscholar-rss`` needs. Refer to the documentation of your feed-reader of choice on how to do-that. As examples:+that. Examples:  - **Newsbeuter/Newsboat**: the relevant manual section is `Scripts and   Filters (Snownews Extensions)`__, which means writing entries like
src/Main.hs view
@@ -1,11 +1,12 @@ {-# Language OverloadedStrings #-}  -- todo [release] date?--- todo [release] fallo diventare script, asptta che cabal 2.4 vaa in+-- todo [release] fallo diventare script, asptta che cabal 2.4 va in --                deb stable.  module Main where +import Control.Applicative import System.Environment import Network.HTTP.Simple import Text.HTML.Scalpel.Core@@ -49,14 +50,15 @@ -- TYPES -- ----------- +type Title = T.Text data Page = Page Title [Article]           deriving (Show, Eq)-type Title = T.Text -data Article = Article Title URL Author-             deriving (Show, Eq) type Author = T.Text type URL = T.Text+type Description = T.Text+data Article = Article Title URL Author Description+             deriving (Show, Eq)   ------------@@ -73,7 +75,14 @@           paper = Article <$> text ("h3" @: [hasClass "gs_rt"])                           <*> (cleanGBooks <$> attr "href" "a")                           <*> text ("div" @: [hasClass "gs_a"])+                          <*> description +description :: Scraper T.Text Description+description = text ("div" @: [hasClass "gs_rs"]) <|>+              pure "No description available."+                    -- todo rimuovi span?+                    -- todo aggiungi test+ buildRSS :: URL -> Page -> RSS buildRSS u (Page t as) =         (nullRSS "rss title" "link") {@@ -81,10 +90,11 @@             rssItems = map buildItem as }}     where           buildItem :: Article -> RSSItem-          buildItem (Article t u a) =+          buildItem (Article t u a d) =                 (nullItem t) {                     rssItemLink = Just $ u,-                    rssItemAuthor = Just $ a }+                    rssItemAuthor = Just $ a,+                    rssItemDescription = Just d }   -------------