如何访问网站并将网站组件转换为字符串。例如从Facebook的帖子中获取信息。我已经做了一些搜索,但找不到任何好的教程或任何有用的东西。将网页源代码转换为NSString
回答
试试看本教程。它应该让你更加熟悉这个主题,并在正确的轨道上开始你。
因为它在教程开始状态...
How to Parse HTML on iOS
Let’s say you want to find some information inside a web page and display it in a custom way in your app. This technique is called “scraping.” Let’s also assume you’ve thought through alternatives to scraping web pages from inside your app, and are pretty sure that’s what you want to do. Well then you get to the question – how can you programmatically dig through the HTML and find the part you’re looking for, in the most robust way possible? Believe it or not, regular expressions won’t cut it! Well, in this tutorial you’ll find out how! You’ll get hands-on experience with parsing HTML into an Objective-C data model that your apps can use.
完美!谢谢! – 2013-05-07 03:42:34
如果您可以总结链接页面,这将是一个更好的答案。就目前而言,如果页面移动或消失,这个答案将毫无用处。 – Caleb 2013-05-07 12:55:56
- 1. 将未知编码的NSData网页转换为NSString
- 2. 将本地JSP页面转换为全局网页而不修改源代码?
- 3. 从GitHub将源代码转换为PDF
- 4. 将Ruby源代码转换为Java源代码
- 5. 将PHP源代码转换为Java源代码?
- 6. 将Java源代码转换为C++源代码的工具
- 7. 如何将Linux C++源代码转换为Windows C++源代码?
- 8. 将HTML代码从页面源代码转换为常规页面源代码 - PHP
- 9. 将base64解码NSData转换为NSString
- 10. 将页面转换为嵌入代码
- 11. 将现有网站源码从开放源码转换为.net
- 12. 如何将网页的Html源代码转换为java中的org.w3c.dom.Document?
- 13. lxml:将网页源代码转换为元素树以进行搜索
- 14. 将代码页中的代码源转换为UTF-8的工具?
- 15. 将Dll代码转换为C源代码
- 16. 如何将Php源代码转换为Asp.net代码
- 17. 如何将Java源代码转换为字节代码?
- 18. 将网页转换为PDF
- 19. 将包含NSString的NSArray转换为NSString
- 20. 将NSString *转换为char?
- 21. 将NSString转换为NSDecimalNumber
- 22. 将NSString转换为UIImage
- 23. 将NSString转换为const char
- 24. 将NSString转换为FBSDKAccessToken
- 25. 将NSData [UIImage]转换为NSString
- 26. 将NSString转换为const char *
- 27. 将散列转换为NSString?
- 28. 将NSString转换为字节
- 29. 将NSString转换为NSDate
- 30. 将NSMutableAttributedString转换为NSString
获取一个HTML解析器 – Kevin 2013-05-07 00:23:22
所以解析HTML,写入文件的应用程序可以访问,然后呢? – 2013-05-07 00:30:49
使用+(id)stringWithContentsOfURL:(NSURL *)url编码:(NSStringEncoding)enc error:(NSError **)error'将想要解析的网页下载到'NSString'中,然后将其传递给HTML解析器并提取您感兴趣的元素。 – Kevin 2013-05-07 00:43:24