https://github.com/itz-fork/vrawler
Helper functions for web scraping in V (vlang)
https://github.com/itz-fork/vrawler
v vlang vlang-module web-scraping
Last synced: 5 months ago
JSON representation
Helper functions for web scraping in V (vlang)
- Host: GitHub
- URL: https://github.com/itz-fork/vrawler
- Owner: Itz-fork
- License: mit
- Created: 2023-11-26T03:31:18.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-30T18:52:56.000Z (over 2 years ago)
- Last Synced: 2025-05-18T19:39:34.871Z (about 1 year ago)
- Topics: v, vlang, vlang-module, web-scraping
- Language: V
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vrawler
Some helper functions that I use to scrape websites
### Retrive by selectors
Used to retrive html elements using css selectors
- Function: `from_selector`
- Arguments:
- `hdoc`: html document as a string (if parsed convert to str with `parsed.str()`)
- `selectors`: string of css selectors (Ex: `#myid > p > a:nth-child(1)`)
Example
```html
Test file
```
```v
import vrawler
fn main() {
// Suppose this index.html == above html
html_str := read_file('/home/scraped/mysite/index.html')
spn := vrawler.from_selector(html_str, '#mydiv > a:nth-child(2) > span')
println(spn)
}
// stdout
// [V]
```