feat: add search filter, refactor params
This commit is contained in:
parent
44e14a4ae0
commit
25de7d678a
24 changed files with 374 additions and 72 deletions
|
|
@ -4,9 +4,8 @@ use url::Url;
|
|||
|
||||
use crate::{
|
||||
error::{Error, ExtractionError},
|
||||
model::{
|
||||
Channel, ChannelInfo, ChannelOrder, ChannelPlaylist, ChannelVideo, Language, Paginator,
|
||||
},
|
||||
model::{Channel, ChannelInfo, ChannelPlaylist, ChannelVideo, Paginator},
|
||||
param::{ChannelOrder, Language},
|
||||
serializer::MapResult,
|
||||
timeago,
|
||||
util::{self, TryRemove},
|
||||
|
|
@ -158,7 +157,7 @@ impl MapResponse<Channel<Paginator<ChannelVideo>>> for response::Channel {
|
|||
fn map_response(
|
||||
self,
|
||||
id: &str,
|
||||
lang: crate::model::Language,
|
||||
lang: Language,
|
||||
_deobf: Option<&crate::deobfuscate::Deobfuscator>,
|
||||
) -> Result<MapResult<Channel<Paginator<ChannelVideo>>>, ExtractionError> {
|
||||
let content = map_channel_content(self.contents, id);
|
||||
|
|
@ -499,9 +498,8 @@ mod tests {
|
|||
|
||||
use crate::{
|
||||
client::{response, MapResponse, RustyPipe},
|
||||
model::{
|
||||
Channel, ChannelInfo, ChannelOrder, ChannelPlaylist, ChannelVideo, Language, Paginator,
|
||||
},
|
||||
model::{Channel, ChannelInfo, ChannelPlaylist, ChannelVideo, Paginator},
|
||||
param::{ChannelOrder, Language},
|
||||
serializer::MapResult,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use crate::{
|
|||
cache::{CacheStorage, FileStorage},
|
||||
deobfuscate::{DeobfData, Deobfuscator},
|
||||
error::{Error, ExtractionError, Result},
|
||||
model::{Country, Language},
|
||||
param::{Country, Language},
|
||||
report::{FileReporter, Level, Report, Reporter},
|
||||
serializer::MapResult,
|
||||
util,
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@ use crate::{
|
|||
deobfuscate::Deobfuscator,
|
||||
error::{DeobfError, Error, ExtractionError},
|
||||
model::{
|
||||
AudioCodec, AudioFormat, AudioStream, AudioTrack, ChannelId, Language, Subtitle,
|
||||
VideoCodec, VideoFormat, VideoPlayer, VideoPlayerDetails, VideoStream,
|
||||
AudioCodec, AudioFormat, AudioStream, AudioTrack, ChannelId, Subtitle, VideoCodec,
|
||||
VideoFormat, VideoPlayer, VideoPlayerDetails, VideoStream,
|
||||
},
|
||||
param::Language,
|
||||
util,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ use serde::Serialize;
|
|||
use crate::{
|
||||
deobfuscate::Deobfuscator,
|
||||
error::{Error, ExtractionError},
|
||||
model::{ChannelId, Language, Paginator, Playlist, PlaylistVideo},
|
||||
model::{ChannelId, Paginator, Playlist, PlaylistVideo},
|
||||
param::Language,
|
||||
timeago,
|
||||
util::{self, TryRemove},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ use crate::{
|
|||
deobfuscate::Deobfuscator,
|
||||
error::{Error, ExtractionError},
|
||||
model::{
|
||||
ChannelId, ChannelTag, Language, Paginator, SearchChannel, SearchItem, SearchPlaylist,
|
||||
ChannelId, ChannelTag, Paginator, SearchChannel, SearchItem, SearchPlaylist,
|
||||
SearchPlaylistVideo, SearchResult, SearchVideo,
|
||||
},
|
||||
param::Language,
|
||||
timeago,
|
||||
util::{self, TryRemove},
|
||||
};
|
||||
|
|
@ -258,7 +259,8 @@ mod tests {
|
|||
|
||||
use crate::{
|
||||
client::{response, MapResponse},
|
||||
model::{Language, Paginator, SearchItem, SearchResult},
|
||||
model::{Paginator, SearchItem, SearchResult},
|
||||
param::Language,
|
||||
serializer::MapResult,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ use serde::Serialize;
|
|||
|
||||
use crate::{
|
||||
error::{Error, ExtractionError},
|
||||
model::{
|
||||
ChannelId, ChannelTag, Chapter, Comment, Language, Paginator, RecommendedVideo,
|
||||
VideoDetails,
|
||||
},
|
||||
model::{ChannelId, ChannelTag, Chapter, Comment, Paginator, RecommendedVideo, VideoDetails},
|
||||
param::Language,
|
||||
serializer::MapResult,
|
||||
timeago,
|
||||
util::{self, TryRemove},
|
||||
|
|
@ -91,7 +89,7 @@ impl MapResponse<VideoDetails> for response::VideoDetails {
|
|||
fn map_response(
|
||||
self,
|
||||
id: &str,
|
||||
lang: crate::model::Language,
|
||||
lang: Language,
|
||||
_deobf: Option<&crate::deobfuscate::Deobfuscator>,
|
||||
) -> Result<MapResult<VideoDetails>, ExtractionError> {
|
||||
let mut warnings = Vec::new();
|
||||
|
|
@ -340,7 +338,7 @@ impl MapResponse<Paginator<RecommendedVideo>> for response::VideoRecommendations
|
|||
fn map_response(
|
||||
self,
|
||||
_id: &str,
|
||||
lang: crate::model::Language,
|
||||
lang: Language,
|
||||
_deobf: Option<&crate::deobfuscate::Deobfuscator>,
|
||||
) -> Result<MapResult<Paginator<RecommendedVideo>>, ExtractionError> {
|
||||
let mut endpoints = self.on_response_received_endpoints;
|
||||
|
|
@ -362,7 +360,7 @@ impl MapResponse<Paginator<Comment>> for response::VideoComments {
|
|||
fn map_response(
|
||||
self,
|
||||
_id: &str,
|
||||
lang: crate::model::Language,
|
||||
lang: Language,
|
||||
_deobf: Option<&crate::deobfuscate::Deobfuscator>,
|
||||
) -> Result<MapResult<Paginator<Comment>>, ExtractionError> {
|
||||
let mut warnings = self.on_response_received_endpoints.warnings;
|
||||
|
|
@ -576,7 +574,8 @@ mod tests {
|
|||
|
||||
use crate::{
|
||||
client::{response, MapResponse, RustyPipe},
|
||||
model::{richtext::ToPlaintext, Language, Verification},
|
||||
model::{richtext::ToPlaintext, Verification},
|
||||
param::Language,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Reference in a new issue