mirror of https://github.com/msfjarvis/twt.git
feat: put videos command behind a Cargo feature
Sadly Twitter appears to have broken it
This commit is contained in:
parent
87f7721348
commit
c8e4e4856e
|
@ -24,6 +24,9 @@ tokio = { version = "1.26.0", features = ["rt-multi-thread", "macros"] }
|
|||
toml = "0.7.2"
|
||||
url = "2.3.1"
|
||||
|
||||
[features]
|
||||
videos = []
|
||||
|
||||
# generated by 'cargo dist init'
|
||||
[profile.dist]
|
||||
inherits = "release"
|
||||
|
|
|
@ -30,6 +30,7 @@ pub enum Commands {
|
|||
Images(Images),
|
||||
#[command(arg_required_else_help = true)]
|
||||
Links(Links),
|
||||
#[cfg(feature = "videos")]
|
||||
#[command(arg_required_else_help = true)]
|
||||
Videos(Videos),
|
||||
}
|
||||
|
@ -83,6 +84,7 @@ impl TimelineCreator for Links {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "videos")]
|
||||
#[derive(Debug, Args)]
|
||||
/// Fetch high quality versions of videos embedded in the user's tweets.
|
||||
pub struct Videos {
|
||||
|
@ -90,6 +92,7 @@ pub struct Videos {
|
|||
opts: CommonCliOpts,
|
||||
}
|
||||
|
||||
#[cfg(feature = "videos")]
|
||||
impl TimelineCreator for Videos {
|
||||
fn timeline(&self, token: Token) -> Timeline {
|
||||
self.create_timeline(&self.opts, token)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
pub mod images;
|
||||
pub mod links;
|
||||
#[cfg(feature = "videos")]
|
||||
pub mod videos;
|
||||
|
||||
use egg_mode::tweet::Tweet;
|
||||
|
|
|
@ -3,7 +3,9 @@ mod cmds;
|
|||
mod config;
|
||||
|
||||
use crate::cli::{Commands, Opts, TimelineCreator};
|
||||
use crate::cmds::{images, links, videos};
|
||||
#[cfg(feature = "videos")]
|
||||
use crate::cmds::videos;
|
||||
use crate::cmds::{images, links};
|
||||
use crate::config::Credentials;
|
||||
use clap::Parser;
|
||||
use color_eyre::Result;
|
||||
|
@ -33,6 +35,7 @@ async fn main() -> Result<()> {
|
|||
let feed = feed.iter();
|
||||
links::invoke(feed, &host);
|
||||
}
|
||||
#[cfg(feature = "videos")]
|
||||
Commands::Videos(opts) => {
|
||||
let timeline = opts.timeline(token);
|
||||
let (_, feed) = timeline.start().await?;
|
||||
|
|
Loading…
Reference in New Issue