diff --git a/Cargo.lock b/Cargo.lock index 9b59966..463e438 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,66 +64,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "derive_builder" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" -dependencies = [ - "darling", - "derive_builder_core", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_builder_core" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "encoding_rs" version = "0.8.26" @@ -261,7 +201,6 @@ name = "holocal" version = "0.1.0" dependencies = [ "reqwest", - "rss", "tokio", ] @@ -335,12 +274,6 @@ dependencies = [ "tokio-tls", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.2.0" @@ -629,16 +562,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "quick-xml" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe1e430bdcf30c9fdc25053b9c459bb1a4672af4617b6c783d7d91dc17c6bbb0" -dependencies = [ - "encoding_rs", - "memchr", -] - [[package]] name = "quote" version = "1.0.8" @@ -739,16 +662,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "rss" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99979205510c60f80a119dedbabd0b8426517384edf205322f8bcd51796bcef9" -dependencies = [ - "derive_builder", - "quick-xml", -] - [[package]] name = "ryu" version = "1.0.5" @@ -834,12 +747,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - [[package]] name = "syn" version = "1.0.56" diff --git a/Cargo.toml b/Cargo.toml index 99ae35a..ca04a65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,4 +12,3 @@ lto = true [dependencies] reqwest = { version = "0.10.10", features = ["default-tls"] } tokio = { version = "0.2.22", features = ["rt-core"] } -rss = "1.9" diff --git a/src/main.rs b/src/main.rs index 21101d1..dfd5c18 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,6 @@ use std::env; use std::io::{stdin, BufRead}; use std::process::{exit, Command}; use std::os::unix::process::CommandExt; -use rss::Channel; use reqwest::Client; extern crate tokio; @@ -69,26 +68,23 @@ fn main() { let text = tokio::runtime::Runtime::new() .unwrap() .block_on(get_feed_text(nitter_instance, &account)); - let channel = Channel::read_from(&text.as_bytes()[..]).unwrap(); - if channel.items().is_empty() { - eprintln!("Cannot find tweet"); - exit(1); - } - let src_attrib = &channel - .items()[0] - .description() - .unwrap() - .rsplitn(2, "\n") - .nth(0) - .unwrap() - .splitn(3, " ") + match &text.splitn(4, "").nth(2) { + Some(title) => println!("{}", &title.splitn(2, "").nth(0).unwrap()), + None => { + eprintln!("Cannot find tweet"); + exit(1); + } + }; + let image_url = text.splitn(3, "