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

Not getting newest item #117

Closed
yous00 opened this issue Jun 19, 2019 · 7 comments
Closed

Not getting newest item #117

yous00 opened this issue Jun 19, 2019 · 7 comments

Comments

@yous00
Copy link

yous00 commented Jun 19, 2019

Hi, Im making a Discord bot that automaticly posts when there is a csgo update. I made it so it checks every minute if there is an update. but for some reason the parser just will not get the latest update. When trying the same code in Npm RunKit it does give the latest item. here is a link to what should work LINK.
I really do not know what I am doing wrong.

@rbren
Copy link
Owner

rbren commented Jun 20, 2019

Sounds like a caching issue. You can try setting the HTTP header Cache-Control: no-cache

Info on setting headers for parseURL here: https://github.com/bobby-brennan/rss-parser#headers

@rbren rbren closed this as completed Oct 3, 2019
@pradeep98n
Copy link

@rbren Cache-Control: no-cache option is not there in headers.
Source code shows only Accept and User-Agent are allowed inside headers.
rss-parse version 3.12.0

@rbren
Copy link
Owner

rbren commented Sep 23, 2022

You can pass in any headers you want with options.headers. We will insert a default Accept and User-Agent if they are not specified.

LMK if there's a bug here, but that's what I'm seeing in the source code.

@pradeep98n
Copy link

@rbren lost the track for few months..
Here is the code ss. It shows error in type-script when I try to add Cache-Control.

Code:

this.rssParser = new Parser({
      headers: {
        Accept: 'application/rss+xml, application/xml, text/xml',
        'Cache-Control': 'no-cache',
      },
    });

error:

Type '{ Accept: string; 'Cache-Control': string; }' is not assignable to type 'Headers'.
  Object literal may only specify known properties, and ''Cache-Control'' does not exist in type 'Headers'.ts(2322)
index.d.ts(20, 14): The expected type comes from property 'headers' which is declared here on type 'ParserOptions<{ [key: string]: any; }, { [key: string]: any; }>'

image1
image2

@rbren
Copy link
Owner

rbren commented Dec 15, 2022

hmm...maybe we need to update the type definitions

@pradeep98n
Copy link

I most of the times get cached response. Usually the newest episodes/updates appear only after 2nd or 3rd refresh. Is there any other work around to get non-cached data by the time new update is rolled out?

@rbren
Copy link
Owner

rbren commented Dec 15, 2022

you can try issuing the HTTP request yourself, without rss-parser. Then you can use parseXML to parse it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants