add get_url_content

This commit is contained in:
2020-01-25 02:11:53 +08:00
parent db82f58a42
commit d0faaeb15e
2 changed files with 6 additions and 0 deletions

View File

@@ -1,6 +1,11 @@
use http::Uri;
use rust_util::*;
pub async fn get_url_content(url: &str) -> XResult<String> {
let client = reqwest::Client::new();
Ok(client.get(url).send().await?.text().await?)
}
pub fn make_url(base_url: &str, ts_url: &str) -> XResult<String> {
let lower_ts_url = ts_url.to_lowercase();
if lower_ts_url.starts_with("http://") || lower_ts_url.starts_with("https://") {

View File

@@ -1,5 +1,6 @@
use http::Uri;
// https://github.com/rutgersc/m3u8-rs/blob/master/examples/simple.rs
fn main() {
println!("Hello, world!");