feat: video_id script, move proto include to lib
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
use tonic::{Request, Response, Status, transport::Server};
|
||||
|
||||
// use stream_list::greeter_server::{Greeter, GreeterServer};
|
||||
// use stream_list::{HelloReply, HelloRequest};
|
||||
use stream_list::{
|
||||
LiveChatMessageListRequest,
|
||||
v3_data_live_chat_message_service_server::V3DataLiveChatMessageService,
|
||||
};
|
||||
pub mod stream_list {
|
||||
tonic::include_proto!("youtube.api.v3");
|
||||
}
|
||||
19
src/lib.rs
Normal file
19
src/lib.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::process::Command;
|
||||
|
||||
pub mod stream_list {
|
||||
tonic::include_proto!("youtube.api.v3");
|
||||
}
|
||||
|
||||
fn get_live_id(channel: String) -> String {
|
||||
let video_id = Command::new("./get_url.sh")
|
||||
.arg(channel)
|
||||
.output()
|
||||
.expect("couldn't execute fetch script");
|
||||
let stdout = video_id.stdout.as_slice().to_vec();
|
||||
String::from_utf8_lossy(&stdout).trim().to_string()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_live_id() {
|
||||
get_live_id("linlyboi".to_string());
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
use client::stream_list::{
|
||||
use tonic::{Request, Status, metadata::MetadataValue, transport::Channel};
|
||||
use youtube_chat_rs::stream_list::{
|
||||
LiveChatMessageListRequest,
|
||||
v3_data_live_chat_message_service_client::V3DataLiveChatMessageServiceClient,
|
||||
};
|
||||
use tonic::{Request, Status, metadata::MetadataValue, transport::Channel};
|
||||
mod grpc;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
Reference in New Issue
Block a user