Web scraping in Objective C

后端 未结 2 2038
误落风尘
误落风尘 2021-02-15 16:22

is there any Objective C library for parsing HTML, like python\'s BeautifulSoup? Thanks

2条回答
  •  情歌与酒
    2021-02-15 16:30

    The best way I have found is NSXMLParser + libtidy. However, there are many third party libraries are available now which makes parsing easier. (last answer was written in 2011).

    • Google's Gumbo HTML5 parser is pretty good. It's written in pure C99 and you can use it with Objective C (use a wrapper like this one).
    • If you want pure Objective C libraries then Ono or hpple are good. HTMLReader is also a good alternative.
    • If Swift is your thing, you could use NDHpple which is a swift wrapper based on hpple. Or You could use Swift-HTML-Parser. (Bonus: Alamofire is as good as Python Requests and is a joy to use)

提交回复
热议问题