Removed rss dependency
this is getting hackier just for less binary size
This commit is contained in:
parent
2187939b36
commit
2312c8dd57
|
@ -64,66 +64,6 @@ version = "0.8.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
|
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]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
version = "0.8.26"
|
version = "0.8.26"
|
||||||
|
@ -261,7 +201,6 @@ name = "holocal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rss",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -335,12 +274,6 @@ dependencies = [
|
||||||
"tokio-tls",
|
"tokio-tls",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ident_case"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -629,16 +562,6 @@ dependencies = [
|
||||||
"unicode-xid",
|
"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]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.8"
|
version = "1.0.8"
|
||||||
|
@ -739,16 +662,6 @@ dependencies = [
|
||||||
"winreg",
|
"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]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
|
@ -834,12 +747,6 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strsim"
|
|
||||||
version = "0.9.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.56"
|
version = "1.0.56"
|
||||||
|
|
|
@ -12,4 +12,3 @@ lto = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
reqwest = { version = "0.10.10", features = ["default-tls"] }
|
reqwest = { version = "0.10.10", features = ["default-tls"] }
|
||||||
tokio = { version = "0.2.22", features = ["rt-core"] }
|
tokio = { version = "0.2.22", features = ["rt-core"] }
|
||||||
rss = "1.9"
|
|
||||||
|
|
28
src/main.rs
28
src/main.rs
|
@ -4,7 +4,6 @@ use std::env;
|
||||||
use std::io::{stdin, BufRead};
|
use std::io::{stdin, BufRead};
|
||||||
use std::process::{exit, Command};
|
use std::process::{exit, Command};
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
use rss::Channel;
|
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
extern crate tokio;
|
extern crate tokio;
|
||||||
|
|
||||||
|
@ -69,26 +68,23 @@ fn main() {
|
||||||
let text = tokio::runtime::Runtime::new()
|
let text = tokio::runtime::Runtime::new()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.block_on(get_feed_text(nitter_instance, &account));
|
.block_on(get_feed_text(nitter_instance, &account));
|
||||||
let channel = Channel::read_from(&text.as_bytes()[..]).unwrap();
|
match &text.splitn(4, "<title>").nth(2) {
|
||||||
if channel.items().is_empty() {
|
Some(title) => println!("{}", &title.splitn(2, "</title>").nth(0).unwrap()),
|
||||||
eprintln!("Cannot find tweet");
|
None => {
|
||||||
exit(1);
|
eprintln!("Cannot find tweet");
|
||||||
}
|
exit(1);
|
||||||
let src_attrib = &channel
|
}
|
||||||
.items()[0]
|
};
|
||||||
.description()
|
let image_url = text.splitn(3, "<img src=\"")
|
||||||
.unwrap()
|
|
||||||
.rsplitn(2, "\n")
|
|
||||||
.nth(0)
|
|
||||||
.unwrap()
|
|
||||||
.splitn(3, " ")
|
|
||||||
.nth(1)
|
.nth(1)
|
||||||
|
.unwrap()
|
||||||
|
.splitn(2, "\"")
|
||||||
|
.nth(0)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("{}", &channel.items()[0].title().unwrap());
|
|
||||||
let mut args = Vec::with_capacity(view_image_command.len() - 1);
|
let mut args = Vec::with_capacity(view_image_command.len() - 1);
|
||||||
for arg in &view_image_command[1..] {
|
for arg in &view_image_command[1..] {
|
||||||
if arg == &"{}" {
|
if arg == &"{}" {
|
||||||
args.push(&src_attrib[5..src_attrib.len() - 1]);
|
args.push(image_url);
|
||||||
} else {
|
} else {
|
||||||
args.push(&arg);
|
args.push(&arg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue