freearhey / epg-grabber

Node.js CLI tool for grabbing EPG from different websites
47 stars 7 forks source link

Fix #12 by ignoring all invalid cookies #14

Closed bratekarate closed 11 months ago

bratekarate commented 1 year ago

epg-grabber sometimes fails silently due to invalid cookie errors. An error is printed, but the exit code is still zero.

It looks something like this:

ERROR: Cookie not in this host's domain. Cookie:horizon.tv Request:static.spark.telenet.tv

This PR configures axios with the option ignoreCookieErrors = true, which gets rid of the error.

Since invalid cookies seem to be set server side in some cases, ignoring them seems to be the only option.

freearhey commented 1 year ago

The axios documentation doesn't say anything about the ignoreInvalidCookies option: https://axios-http.com/docs/req_config

Or is there some other place where I can learn something about it?

bratekarate commented 1 year ago

Hi @freearhey,

sorry for not getting back to you earlier, I have been off Github for a while and did not expect any questions about my change.

Can you please reopen this PR? I can maintain my own epg-grabber fork for a while, but it would be nice to solve this upstream at some point.

The option is called ignoreCookieErrors, not ignoreInvalidCookies. Excuse my typo, I corrected it in the original PR description.

The reason you had trouble finding it is that it is not part of axios, it belongs to axios-cookiejar-support. Further, it has been dropped with version 2.0 of axios-cookiejar-support, hence it is very hard to find the documentation. Check out the 1.x branch of axios-cookiejar-support for the official documentation: https://github.com/3846masa/axios-cookiejar-support/tree/v1.x#extended-request-config

The removal of the config property is described In the migration guide: https://github.com/3846masa/axios-cookiejar-support/blob/main/MIGRATION.md#invalid-cookies-will-always-be-ignored

As noted in the migration guide, ignoreCookieErrors is the default since 2.0, hence the option does not exist anymore. So it would be great if you could solve the issue in one of the following two ways:

  1. Accept this PR so that invalid cookies will not break the execution of the grabber
  2. Upgrade axios-cookiejar-support to at least v2. However, it is already at v4.

Since some dependencies have fallen far behind by now, I can gladly upgrade them, fix any issues and open a PR for that. Just let me know how I can help, as I would really love to see this merged.

freearhey commented 11 months ago

Thanks for the help!

Fixed in v0.33.0