twitter import fix

This commit is contained in:
Dhravya Shah 2025-02-14 14:02:47 -08:00
parent d0bcac186a
commit c825043b84
4 changed files with 38 additions and 4 deletions

View file

@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/chrome-manifest.json",
"manifest_version": 3,
"version": "5.0.135",
"version": "5.0.200",
"homepage_url": "https://supermemory.ai",
"name": "Supermemory",
"description": "An extension for https://supermemory.ai - an AI hub for all your knowledge.",

View file

@ -214,7 +214,41 @@ const getBookmarks = async (cursor = "", totalImported = 0, allTweets = []) => {
return getBookmarks(cursor, totalImported, allTweets);
}
const data = (await response.json()) as any;
let data = (await response.json()) as any;
// Handle 400 error with missing features
if (response.status === 400 && data.errors?.[0]?.message) {
const errorMsg = data.errors[0].message;
const missingFeatures = errorMsg.match(
/following features cannot be null: (.*?)$/
)?.[1];
if (missingFeatures) {
const featuresList = missingFeatures.split(", ");
const updatedFeatures = { ...features };
featuresList.forEach((feature: string) => {
updatedFeatures[feature as keyof typeof updatedFeatures] = true;
});
// Retry with updated features
const newUrl = `https://x.com/i/api/graphql/${
sessionResult.bookmarksApiId
}/Bookmarks?features=${encodeURIComponent(
JSON.stringify(updatedFeatures)
)}&variables=${encodeURIComponent(JSON.stringify(variables))}`;
const retryResponse = await fetch(newUrl, {
method: "GET",
headers: headers,
redirect: "follow",
});
const retryData = await retryResponse.json();
data = retryData;
}
}
const entries =
data.data?.bookmark_timeline_v2?.timeline?.instructions?.[0]?.entries ||
[];

View file

@ -727,7 +727,7 @@ function SharedCard({ data }: { data: Memory }) {
)}
>
<a href={`/content/${data.uuid}`}>
{data.type !== "space" && data.type !== "document" && (
{data.type !== "space" && (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<div className="absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded-full bg-white/70 dark:bg-gray-900/70 px-2 py-1 text-xs font-medium text-gray-600 dark:text-gray-300 shadow-sm/50 backdrop-blur-[2px] border border-gray-200/30 dark:border-gray-700/30">

View file

@ -6,6 +6,6 @@ export const getChromeExtensionId = () => {
// if (environment === "development") {
// return "hepmifhfbiehpdlbeigpapkmjcaphfmn";
// }
// return "hepmifhfbiehpdlbeigpapkmjcaphfmn";
// return "lcmcmhklcjciegoakjejefbacbgikncb";
return "afpgkkipfdpeaflnpoaffkcankadgjfc";
};