thumb updates
This commit is contained in:
@@ -1141,8 +1141,10 @@ impl ShooshtimeProvider {
|
||||
item = item.preview(preview.clone());
|
||||
}
|
||||
}
|
||||
if let Some(thumb) = preview_url {
|
||||
item.thumb = thumb;
|
||||
if item.thumb.is_empty() {
|
||||
if let Some(thumb) = preview_url {
|
||||
item.thumb = thumb;
|
||||
}
|
||||
}
|
||||
if let Some(source) = embed_url {
|
||||
item = item.embed(VideoEmbed {
|
||||
@@ -1308,3 +1310,39 @@ impl Provider for ShooshtimeProvider {
|
||||
Some(self.build_channel(clientversion))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ShooshtimeProvider;
|
||||
use crate::videos::VideoItem;
|
||||
|
||||
#[test]
|
||||
fn preserves_list_thumb_when_detail_has_preview_url() {
|
||||
let provider = ShooshtimeProvider::new();
|
||||
let item = VideoItem::new(
|
||||
"123".to_string(),
|
||||
"Example".to_string(),
|
||||
"https://shooshtime.com/videos/example/123/".to_string(),
|
||||
"shooshtime".to_string(),
|
||||
"https://shooshtime.com/list-thumb.jpg".to_string(),
|
||||
0,
|
||||
);
|
||||
let html = r#"
|
||||
<script>
|
||||
var flashvars = {
|
||||
preview_url: 'https://shooshtime.com/detail-thumb.jpg'
|
||||
};
|
||||
</script>
|
||||
"#;
|
||||
|
||||
let enriched = provider
|
||||
.apply_detail_video(item, html, "https://shooshtime.com/videos/example/123/")
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(enriched.thumb, "https://shooshtime.com/list-thumb.jpg");
|
||||
assert_eq!(
|
||||
enriched.preview.as_deref(),
|
||||
Some("https://shooshtime.com/detail-thumb.jpg")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user