pub struct TikTokData {
client: Client,
encoder_task: EncoderTask,
pub post_page_cache: TimedCache<String, Post>,
video_download_cache_path: Utf8PathBuf,
video_download_request_map: Arc<RequestMap<String, Result<Arc<Utf8Path>, ArcAnyhowError>>>,
video_encoder: &'static str,
}Expand description
TikTok Data
Fields§
§client: ClientThe inner client
encoder_task: EncoderTaskThe encoder task
post_page_cache: TimedCache<String, Post>A cache of post urls => post pages
video_download_cache_path: Utf8PathBufThe path to tiktok’s cache dir
video_download_request_map: Arc<RequestMap<String, Result<Arc<Utf8Path>, ArcAnyhowError>>>The request map for making requests for video downloads.
video_encoder: &'static strImplementations§
Source§impl TikTokData
impl TikTokData
Sourcepub async fn new<P>(cache_dir: P, encoder_task: EncoderTask) -> Result<Self>where
P: AsRef<Utf8Path>,
pub async fn new<P>(cache_dir: P, encoder_task: EncoderTask) -> Result<Self>where
P: AsRef<Utf8Path>,
Make a new TikTokData.
Sourcepub async fn get_post_cached(
&self,
url: &str,
) -> Result<Arc<TimedCacheEntry<Post>>>
pub async fn get_post_cached( &self, url: &str, ) -> Result<Arc<TimedCacheEntry<Post>>>
Get a post page, using the cache if needed
Sourcepub async fn get_video_data_cached(
&self,
id: u64,
format: &str,
url: &str,
video_duration: u64,
) -> Result<Arc<Utf8Path>>
pub async fn get_video_data_cached( &self, id: u64, format: &str, url: &str, video_duration: u64, ) -> Result<Arc<Utf8Path>>
Get video data, using the cache if needed
Sourcepub async fn try_embed_url(
&self,
ctx: &Context,
msg: &Message,
url: &Url,
loading_reaction: &mut Option<LoadingReaction>,
delete_link: bool,
) -> Result<()>
pub async fn try_embed_url( &self, ctx: &Context, msg: &Message, url: &Url, loading_reaction: &mut Option<LoadingReaction>, delete_link: bool, ) -> Result<()>
Try embedding a url
Trait Implementations§
Source§impl CacheStatsProvider for TikTokData
impl CacheStatsProvider for TikTokData
Source§fn publish_cache_stats(&self, cache_stats_builder: &mut CacheStatsBuilder)
fn publish_cache_stats(&self, cache_stats_builder: &mut CacheStatsBuilder)
Publish stats to the provided
CacheStatsBuilder.Source§impl Clone for TikTokData
impl Clone for TikTokData
Source§fn clone(&self) -> TikTokData
fn clone(&self) -> TikTokData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TikTokData
impl !RefUnwindSafe for TikTokData
impl Send for TikTokData
impl Sync for TikTokData
impl Unpin for TikTokData
impl !UnwindSafe for TikTokData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request