This repository has been archived by the owner on Aug 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from muharamdani/refactor/change-from-puppeteer…
…-to-fetch Refactor | Change from puppeteer to fetch
- Loading branch information
Showing
10 changed files
with
99 additions
and
1,806 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
import fetch from 'cross-fetch'; | ||
export const scrape = async () => { | ||
const _pb = await fetch("https://poe.com/login"), pbCookie = _pb.headers.get("set-cookie")?.split(";")[0]; | ||
const _setting = await fetch('https://poe.com/api/settings', { headers: { cookie: `${pbCookie}` } }); | ||
if (_setting.status !== 200) | ||
throw new Error("Failed to fetch token"); | ||
const appSettings = await _setting.json(), { tchannelData: { channel: channelName } } = appSettings; | ||
return { | ||
pbCookie, | ||
channelName, | ||
appSettings, | ||
}; | ||
}; | ||
export default scrape; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.