Skip to content

Commit

Permalink
Add service with instruction on how to download videos outside of ass…
Browse files Browse the repository at this point in the history
…istant
  • Loading branch information
twinkarma committed Jul 4, 2024
1 parent 8c235a9 commit e757d2a
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 28 additions & 3 deletions src/components/NavItems/Assistant/AssistantRuleBook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import metadataIconOff from "../../NavBar/images/tools/metadataOff.png";
import videoRightsIconOff from "../../NavBar/images/tools/copyrightOff.png";
import forensicIconOff from "../../NavBar/images/tools/forensic_logoOff.png";
import videoIconOff from "../../NavBar/images/tools/video_logoOff.png";
import downloadIconOff from "../../NavBar/images/tools/fileDownload.png";

export const NE_SUPPORTED_LANGS = ["en", "pt", "fr", "de", "el", "es", "it"];

Expand Down Expand Up @@ -138,8 +139,6 @@ export const ASSISTANT_ACTIONS = [
linksAccepted: [
KNOWN_LINKS.YOUTUBE,
KNOWN_LINKS.FACEBOOK,
KNOWN_LINKS.DAILYMOTION,
KNOWN_LINKS.VIMEO,
KNOWN_LINKS.YOUTUBE,
KNOWN_LINKS.YOUTUBESHORTS,
KNOWN_LINKS.LIVELEAK,
Expand Down Expand Up @@ -223,14 +222,40 @@ export const ASSISTANT_ACTIONS = [
{
title: "assistant_video_download_action",
icon: videoIconOff,
linksAccepted: [KNOWN_LINKS.TELEGRAM, KNOWN_LINKS.FACEBOOK],
linksAccepted: [
KNOWN_LINKS.TELEGRAM,
KNOWN_LINKS.FACEBOOK,
KNOWN_LINKS.TWITTER,
],
cTypes: [CONTENT_TYPE.VIDEO],
exceptions: [],
useInputUrl: false,
text: "assistant_video_download_action_description",
tsvPrefix: "assistant_video",
download: true,
},
{
title: "assistant_video_download_instagram",
icon: downloadIconOff,
linksAccepted: [KNOWN_LINKS.INSTAGRAM],
cTypes: [CONTENT_TYPE.VIDEO],
exceptions: [],
useInputUrl: false,
text: "You can download it here",
tsvPrefix: "assistant_video",
path: null,
},
{
title: "assistant_video_download_tiktok",
icon: downloadIconOff,
linksAccepted: [KNOWN_LINKS.TIKTOK],
cTypes: [CONTENT_TYPE.VIDEO],
exceptions: [],
useInputUrl: false,
text: "<p>More analysis tools are available when uploading video files.</p> <p>Weverify Assistant does not support the direct downloading of TikTok video but you can go to the TikTok page and right click the video to download it directly.</p>",
tsvPrefix: "assistant_video",
path: null,
},
];

export const selectCorrectActions = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const AssistantProcessUrlActions = () => {
dl.setAttribute("href", resultUrl);
dl.setAttribute("download", "");
dl.click();
} else if (resultUrl != null) {
} else if (action.path === null) {
return; // Do nothing if path is null
} else if (resultUrl !== null) {
navigate(
"/app/" +
action.path +
Expand Down Expand Up @@ -85,7 +87,13 @@ const AssistantProcessUrlActions = () => {
}
secondary={
<Typography color={"textSecondary"} component={"span"}>
<Box fontStyle="italic">{keyword(action.text)}</Box>
<Box fontStyle="italic">
<div
dangerouslySetInnerHTML={{
__html: keyword(action.text),
}}
></div>
</Box>
</Typography>
}
/>
Expand Down
51 changes: 50 additions & 1 deletion tests/e2e/assistant.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,25 @@ const MediaServices = {
forensic: "navbar_forensic",
ocr: "navbar_ocr",
videoDownload: "assistant_video_download_action",
videoDownloadInstagram: "assistant_video_download_instagram",
videoDownloadTiktok: "assistant_video_download_tiktok",
};

[
// Twitter image post
{
url: "https://twitter.com/vesinfiltro/status/1253122594976468993/photo/1",
mediaType: MediaType.image,
mediaStatus: MediaVideoStatus.noEmbed,
services: [MediaServices.analysisImage, MediaServices.magnifier, MediaServices.forensic, MediaServices.ocr]
},
// Twitter video post
{
url: "https://twitter.com/NatGeo/status/1334635273888514048/video/1",
mediaType: MediaType.video,
mediaStatus: MediaVideoStatus.noEmbed,
services: [MediaServices.metadata, MediaServices.videoDownload]
},
// Youtube video
{
url: "https://www.youtube.com/watch?v=UXrkN0iQmZQ",
Expand Down Expand Up @@ -77,8 +93,41 @@ const MediaServices = {
url: "https://www.instagram.com/p/C8JwcyOiFDD/",
mediaType: MediaType.video,
mediaStatus: MediaVideoStatus.noEmbed,
services: [MediaServices.videoDownloadInstagram]
},
// TikTok video post
{
url: "https://www.tiktok.com/@deeptomcruise/video/7223086851236646149",
mediaType: MediaType.video,
mediaStatus: MediaVideoStatus.noEmbed,
services: [MediaServices.videoDownloadTiktok]
},
{
url: "https://vimeo.com/389685467",
mediaType: MediaType.video,
mediaStatus: MediaVideoStatus.iframe,
services: []
}
},
{
url: "https://www.dailymotion.com/video/x91gv4a",
mediaType: MediaType.video,
mediaStatus: MediaVideoStatus.iframe,
services: []
},
// Mastodon link with youtube video link
{
url: "https://mstdn.social/@BBC/105203076554056414",
mediaType: MediaType.video,
mediaStatus: MediaVideoStatus.video,
services: []
},
// Mastodon link with embedded video
{
url: "https://mstdn.social/@dtnsshow/112728823075224415",
mediaType: MediaType.video,
mediaStatus: MediaVideoStatus.video,
services: []
},
].forEach(({url, videoGridIndex, imageGridIndex, mediaType, mediaStatus, services}) => {
test(`Test assistant media services for url: ${url}`, async ({ page, extensionId }) => {

Expand Down

0 comments on commit e757d2a

Please sign in to comment.