Skip to content

Ad-hoc cookies retrieval during runtime? #400

Description

@vhbui02

This is your reply from worker_vm#2:

Is it possible to also pass cookies to ComicCrawler?

Yes, I know what cookies Colamanga used to authenticate, so I can populate them manually.

There are several ways to use cookies in ComicCrawler:

  1. Define browser and browser_profile in setting.ini. ComicCrawler will import cookies from the browser automatically. (https://github.com/eight04/ComicCrawler?tab=readme-ov-file#%E9%97%9C%E6%96%BC%E9%9C%80%E8%A6%81%E7%99%BB%E5%85%A5%E7%9A%84%E7%B6%B2%E7%AB%99)
  2. In the module, set a cookie global variable to define cookies.
  3. During runtime, get the session object and configure its cookies property. For example:
    def init_api_session():
    . This example configures headers but cookies are similar.

All 3 required populating cookies manually either by going to the website once, open DevTools and copy the cookie or specify browser= in setting.ini (btw 3 is actually the last step of 1). What if I know the API that set the authentication cookies, can I fetch it and retrieve the cookies from response object? It could become the 4th way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions