Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vmanot/browserkit
Web-scraping made easy with Swift.
https://github.com/vmanot/browserkit
async-await framework swift web-scraping
Last synced: 2 months ago
JSON representation
Web-scraping made easy with Swift.
- Host: GitHub
- URL: https://github.com/vmanot/browserkit
- Owner: vmanot
- Created: 2022-12-17T16:12:03.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-27T01:23:38.000Z (5 months ago)
- Last Synced: 2024-07-27T02:33:54.334Z (5 months ago)
- Topics: async-await, framework, swift, web-scraping
- Language: Swift
- Homepage:
- Size: 906 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BrowserKit
[![Build all platforms](https://github.com/vmanot/BrowserKit/actions/workflows/swift.yml/badge.svg)](https://github.com/vmanot/BrowserKit/actions/workflows/swift.yml)
# Requirements
- Deployment target: iOS 16, macOS 13
- Xcode 15+# Usage
The main export of this package is `BKWebView`.
## Bundled JavaScript libraries
### [`turndown.js`](https://github.com/mixmark-io/turndown)
turndown is an HTML to Markdown converter written in JavaScript. BrowserKit ships a minified version of `turndown.js` that makes it easy to scrape web pages using a modern Swift API:
For example:
```swift
let turndown = await _TurndownJS()let urlRequest = URLRequest(url: URL(string: "https://en.wikipedia.org/wiki/Web_scraping")!)
let htmlString = try await URLSession.shared.data(for: urlRequest).0.toString()let markdown = try await turndown.convert(htmlString: htmlString)
print(markdown)
```