DEV Community


Discussion on: Comparing the same web scraper in Haskell, Python, Go

yujiri8 profile image
Ryan Westlund Author

Wow! I didn't know about that library. That does much more for me here than even BeautifulSoup! New&Improved Go version:

package main

import (


func main() {
    var col = colly.NewCollector()
    col.OnHTML("#recentcomments > *:first-child", func(e *colly.HTMLElement) {

That gets it down to about same number of "meaningful" lines as Python. Technically can drop 2 more lines by putting the function inline, but I wouldn't do that IRL.