如何訪問網站並將網站組件轉換爲字符串。例如從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. 將Java源代碼轉換爲C++源代碼的工具
- 4. 將Ruby源代碼轉換爲Java源代碼
- 5. 將base64解碼NSData轉換爲NSString
- 6. 如何將網頁的Html源代碼轉換爲java中的org.w3c.dom.Document?
- 7. 如何將代碼頁ascii轉換爲代碼頁1255
- 8. 將代碼頁中的代碼源轉換爲UTF-8的工具?
- 9. 將網頁轉換爲PDF
- 10. 如何將Php源代碼轉換爲Asp.net代碼
- 11. 將Dll代碼轉換爲C源代碼
- 12. 如何將Java源代碼轉換爲字節代碼?
- 13. 將包含NSString的NSArray轉換爲NSString
- 14. 將NSString轉換爲整數
- 15. 將pid_t轉換爲NSString
- 16. 將NSDictionary轉換爲NSString
- 17. 將NSData [UIImage]轉換爲NSString
- 18. 將NSString轉換爲NSArray
- 19. 將NSString轉換爲std :: string
- 20. 將UITextField值轉換爲NSString
- 21. 將NSString轉換爲小數
- 22. 將NSString轉換爲NSDictionary
- 23. 將nsstring轉換爲cllcoordinate
- 24. 將NSString轉換爲NSTimeInterval
- 25. 將char轉換爲NSString
- 26. 將NSData轉換爲NSString
- 27. 將unsigned char轉換爲NSString
- 28. 將NSString轉換爲NSDate
- 29. 將NSString轉換爲const char *
- 30. 將NSString *轉換爲char?
獲取一個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