GithubHelp home page GithubHelp logo

Hit count sample no longer works about tagsoup HOT 8 CLOSED

rcook avatar rcook commented on June 10, 2024
Hit count sample no longer works

from tagsoup.

Comments (8)

ChristopherKing42 avatar ChristopherKing42 commented on June 10, 2024

😢 I suppose we could place an issue here: https://github.com/haskell-infra/hl

from tagsoup.

rcook avatar rcook commented on June 10, 2024

I was thinking that a nice replacement example would be the Hackage page for this package: http://hackage.haskell.org/package/tagsoup. The example could extract the "Downloads" count from this page. I would rewrite the sample myself, but I haven't figured out how to use the package yet!

from tagsoup.

erewok avatar erewok commented on June 10, 2024

You could just switch it to the last modified date at https://wiki.haskell.org/Haskell, which contains the same markup as it did before (I think):

<ul id="f-list">
  <li id="lastmod"> This page was last modified on 9 September 2013, at 22:38.</li>
  <li id="copyright">Recent content is available under <a href="/HaskellWiki:Copyrights" title="HaskellWiki:Copyrights">a simple permissive license</a>.</li>

Which make the example something like:

haskellHitCount = do
    src <- openURL "http://haskell.org/haskellwiki/Haskell"
    let modified = fromFooter $ parseTags src
    putStrLn modified
    where fromFooter = innerText . take 2 . dropWhile (~/= "<li id=lastmod>")

Alternately, to get the "Downloads" count you were looking for on the hackage page, something like the following should work, I think:

let table = dropWhile (~/= "<table class=properties>") $ parseTags src
let downloads = fromTagText . head . drop 1 . dropWhile (~/= "Downloads") $ filter isTagText table

from tagsoup.

ChristopherKing42 avatar ChristopherKing42 commented on June 10, 2024

👍 for Downloads count

from tagsoup.

rcook avatar rcook commented on June 10, 2024

I'll update the example to use last modified date for now. If I have time, I'll add an example that does download count too.

from tagsoup.

ChristopherKing42 avatar ChristopherKing42 commented on June 10, 2024

@rcook It appears that https://github.com/ndmitchell/tagsoup/blob/master/TagSoup/Sample.hs is where this would go.

from tagsoup.

rcook avatar rcook commented on June 10, 2024

@theking42 : Thanks!

from tagsoup.

ndmitchell avatar ndmitchell commented on June 10, 2024

Thanks @rcook and @theking42 for your patches and figuring out the problem and solution. I raised #40 to use Travis to run the demos, and hopefully catch such issues before users run into them.

from tagsoup.

Related Issues (20)

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.