From 0a70924df7b85d482b1d95f86b72829671233e1b Mon Sep 17 00:00:00 2001 From: Borber Date: Wed, 11 Jan 2023 23:48:47 +0800 Subject: [PATCH] =?UTF-8?q?[mod]=20=E6=94=AF=E6=8C=81=E5=BF=AB=E6=89=8B?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E6=BA=90=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ README.md | 1 + src/live/kuaishou.rs | 56 ++++++++++++++++++++++++++++++++++++++++++++ src/live/mod.rs | 1 + src/main.rs | 8 ++++++- 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/live/kuaishou.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f9b6a8..03bb989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- 支持快手直播源获取 ## [0.1.5] - 2023-01-11 diff --git a/README.md b/README.md index 2645b13..d4d7d73 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ - [ ] 根据画质排序 - [ ] gui - [ ] mpv播放 +- [ ] 是否一次性链接标识字段 # 说明 diff --git a/src/live/kuaishou.rs b/src/live/kuaishou.rs new file mode 100644 index 0000000..134a9cc --- /dev/null +++ b/src/live/kuaishou.rs @@ -0,0 +1,56 @@ +use anyhow::{Ok, Result}; +use regex::Regex; + +use crate::{ + common::{CLIENT, USER_AGENT}, + modle::{Node, ShowType}, +}; + +const URL: &str = "https://live.kuaishou.com/u/"; + +/// 快手直播 +/// +/// https://live.kuaishou.com/ +pub async fn get(rid: &str) -> Result { + let text = CLIENT + .get(format!("{}{}", URL, rid)) + .header("User-Agent", USER_AGENT) + .header("Cookie", "did=web_d563dca728d28b00336877723e0359ed;") + .send() + .await? + .text() + .await?; + let re = Regex::new(r#"