tovuk 0.1.114

Use Tovuk scraper APIs from a native CLI.
1
2
3
4
5
6
7
8
9
10
use serde_json::Value;

pub(crate) fn optional_string_field(value: &Value, key: &str) -> Option<String> {
    value
        .get(key)
        .and_then(Value::as_str)
        .map(str::trim)
        .filter(|value| !value.is_empty())
        .map(str::to_owned)
}