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

Persist cookies + localStorage plugin #804

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

kangoo13
Copy link

@kangoo13 kangoo13 commented May 7, 2023

Hello everybody,

The ways to retrieve new cookies/localStorage are a bit tricky but I didn't find any other better solution, yet.

If you have any idea do not hesitate I can implement them.

The plugin is available here meanwhile the PR is merged :
https://www.npmjs.com/package/puppeteer-extra-plugin-session-persistence

This is my first code on TypeScript I am not really used to it, do not hesitate to tell me how can I improve this code !

#459

@github-actions github-actions bot added the plugin: puppeteer-extra PuppeteerExtra Plugin related label May 7, 2023
Copy link

@clouedoc clouedoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want, here is some code for IndexedDB: https://github.com/clouedoc/puppeteer-extra-plugin-session/blob/master/src/providers/indexedDb.ts

  1. Do not use tslint; use ESLint with typescript-eslint instead. This is because TSLint is now deprecated. Rush Stack has a great starter ESLint file.
  2. Polling might be a bit aggressive
  3. IIRC NodeJS 20 has a built-in testing tool
  4. Storage engines feel out of scope. The responsibility is better left to the user, or there will be complaints in GitHub issues. Of course, that's only my opinion; I appreciate the value of having storage engines available out-of-the-shelf 🙂

todo: make a PR to puppeteer-extra to change the PluginData interface, name and value should not be an object but any instead.

No, it should be unknown to force the developer to do a type assertion.anys are to be avoided at all costs. Every time you commit an any, a developer at the end of the world gets depression.
To learn this kind of stuff, I highly recommend the book Efficient TypeScript

In this specific case, you should have created an interface with the structure of how your plugin options should look like.


In any case, enormous props for submitting your code 🙂
You are very welcome in our small community 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: puppeteer-extra PuppeteerExtra Plugin related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants