-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63fc36c
commit ff89381
Showing
4 changed files
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./handle-twitter-auth.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Scraper } from "@the-convocation/twitter-scraper"; | ||
|
||
import { getCookies } from "../cookies/get-cookies.js"; | ||
import { TouitomamoutError } from "../error.js"; | ||
|
||
export const restorePreviousSession = async ( | ||
client: Scraper, | ||
): Promise<void> => { | ||
try { | ||
const cookies = await getCookies(); | ||
if (cookies) { | ||
await client.setCookies(cookies); | ||
} else { | ||
throw new Error("Unable to restore cookies"); | ||
} | ||
} catch (err) { | ||
console.log( | ||
TouitomamoutError(err as string, [ | ||
"Logging in with credentials instead.", | ||
]), | ||
); | ||
} | ||
}; |