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

Adding vk.com support #500

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions src/components/NavItems/Assistant/AssistantRuleBook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const KNOWN_LINKS = {
VIMEO: "vimeo",
MASTODON: "mastodon",
OWN: "own",
VK: "vk",
MISC: "general",
};

Expand Down Expand Up @@ -93,6 +94,12 @@ export const KNOWN_LINK_PATTERNS = [
key: KNOWN_LINKS.MASTODON,
patterns: ["^(?:https?:/{2})?(www.)?.+..+/@.*/d*"],
},
{
key: KNOWN_LINKS.VK,
patterns: [
"(https?:\\/{2})?(www.)?vk.com\\/(wall|video)(-?)\\d*_\\d*(\\??)",
],
},
{
key: KNOWN_LINKS.MISC,
patterns: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const AssistantVideoResult = () => {
}
break;
case KNOWN_LINKS.YOUTUBESHORTS:
embedURL = null; // Null as youtube shorts does not support embedding
case KNOWN_LINKS.VK:
embedURL = null; // Null as youtube shorts and vk do not support embedding
break;
case KNOWN_LINKS.VIMEO:
stringToMatch = "vimeo.com/";
Expand Down
6 changes: 3 additions & 3 deletions src/redux/sagas/assistantSaga.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ const decideWhetherToScrape = (urlType, contentType) => {
case KNOWN_LINKS.TWITTER:
case KNOWN_LINKS.TELEGRAM:
case KNOWN_LINKS.MASTODON:
case KNOWN_LINKS.VK:
return true;
case KNOWN_LINKS.MISC:
if (contentType === null) {
Expand Down Expand Up @@ -637,6 +638,7 @@ const filterAssistantResults = (
}
break;
case KNOWN_LINKS.TELEGRAM:
case KNOWN_LINKS.VK:
if (scrapeResult.images.length > 0) {
imageList = scrapeResult.images;
}
Expand Down Expand Up @@ -687,11 +689,9 @@ const filterSourceCredibilityResults = (
linkList,
trafficLightColors,
) => {
//if (!originalResult.entities.SourceCredibility) {
if (!originalResult) {
if (!originalResult.length) {
return [null, null, null, null];
}
//let sourceCredibility = originalResult.entities.SourceCredibility;
let sourceCredibility = originalResult;

sourceCredibility.forEach((dc) => {
Expand Down