Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jmafoster1/58 suport snapchat links #685

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/components/NavItems/Assistant/AssistantRuleBook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const CONTENT_TYPE = {
export const KNOWN_LINKS = {
TWITTER: "twitter",
INSTAGRAM: "instagram",
SNAPCHAT: "snapchat",
FACEBOOK: "facebook",
TIKTOK: "tiktok",
TELEGRAM: "telegram",
Expand Down Expand Up @@ -61,6 +62,13 @@ export const KNOWN_LINK_PATTERNS = [
key: KNOWN_LINKS.TIKTOK,
patterns: ["((https?:\\/{2})?(www.)?tiktok.com\\/.*\\/video/\\d*)"],
},
{
key: KNOWN_LINKS.SNAPCHAT,
patterns: [
"((https?:\\/{2})?(www.)?snapchat.com\\/(spotlight|lens)/\\w*)",
"((https?:\\/{2})?(www.)?snapchat.com\\/p\\/[\\w\\-]+\\/\\w*)",
],
},
{
key: KNOWN_LINKS.INSTAGRAM,
patterns: [
Expand Down Expand Up @@ -123,7 +131,11 @@ export const ASSISTANT_ACTIONS = [
{
title: "navbar_analysis_video",
icon: <videoAnalysis.icon sx={{ fontSize: "24px" }} />,
linksAccepted: [KNOWN_LINKS.YOUTUBE, KNOWN_LINKS.FACEBOOK],
linksAccepted: [
KNOWN_LINKS.YOUTUBE,
KNOWN_LINKS.FACEBOOK,
KNOWN_LINKS.SNAPCHAT,
],
cTypes: [CONTENT_TYPE.VIDEO],
exceptions: [],
useInputUrl: true,
Expand All @@ -134,7 +146,11 @@ export const ASSISTANT_ACTIONS = [
{
title: "navbar_analysis_image",
icon: <imageAnalysis.icon sx={{ fontSize: "24px" }} />,
linksAccepted: [KNOWN_LINKS.FACEBOOK, KNOWN_LINKS.TWITTER],
linksAccepted: [
KNOWN_LINKS.FACEBOOK,
KNOWN_LINKS.TWITTER,
KNOWN_LINKS.SNAPCHAT,
],
cTypes: [CONTENT_TYPE.IMAGE],
exceptions: [],
useInputUrl: true,
Expand All @@ -151,6 +167,7 @@ export const ASSISTANT_ACTIONS = [
KNOWN_LINKS.YOUTUBE,
KNOWN_LINKS.YOUTUBESHORTS,
KNOWN_LINKS.LIVELEAK,
KNOWN_LINKS.SNAPCHAT,
KNOWN_LINKS.OWN,
],
cTypes: [CONTENT_TYPE.VIDEO],
Expand Down Expand Up @@ -188,7 +205,7 @@ export const ASSISTANT_ACTIONS = [
processLinksAccepted: [KNOWN_LINKS.MISC, KNOWN_LINKS.OWN],
cTypes: [CONTENT_TYPE.IMAGE, CONTENT_TYPE.VIDEO],
exceptions: [
/(pbs.twimg.com)|(youtu.be|youtube)|(instagram)|(fbcdn.net)|(vimeo)|(tiktok.com)/,
/(pbs.twimg.com)|(youtu.be|youtube)|(instagram)|(fbcdn.net)|(vimeo)|(snapchat)|(tiktok.com)/,
],
useInputUrl: false,
text: "metadata_text",
Expand Down Expand Up @@ -272,6 +289,7 @@ export const ASSISTANT_ACTIONS = [
KNOWN_LINKS.FACEBOOK,
KNOWN_LINKS.TWITTER,
KNOWN_LINKS.MASTODON,
KNOWN_LINKS.SNAPCHAT,
],
cTypes: [CONTENT_TYPE.VIDEO],
exceptions: [],
Expand Down
9 changes: 9 additions & 0 deletions src/redux/sagas/assistantSaga.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ const decideWhetherToScrape = (urlType, contentType) => {
case KNOWN_LINKS.INSTAGRAM:
case KNOWN_LINKS.FACEBOOK:
case KNOWN_LINKS.TWITTER:
case KNOWN_LINKS.SNAPCHAT:
case KNOWN_LINKS.TELEGRAM:
case KNOWN_LINKS.MASTODON:
case KNOWN_LINKS.VK:
Expand Down Expand Up @@ -807,6 +808,14 @@ const filterAssistantResults = (
videoList = scrapeResult.videos;
}
break;
case KNOWN_LINKS.SNAPCHAT:
if (scrapeResult.images.length > 0) {
imageList = scrapeResult.images;
}
if (scrapeResult.videos.length > 0) {
videoList = scrapeResult.videos;
}
break;
case KNOWN_LINKS.MASTODON:
case KNOWN_LINKS.TELEGRAM:
case KNOWN_LINKS.VK:
Expand Down
Loading