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

feat: add naver webtoon #3376

Merged
merged 4 commits into from Dec 7, 2019
Merged

feat: add naver webtoon #3376

merged 4 commits into from Dec 7, 2019

Conversation

zfanta
Copy link
Contributor

@zfanta zfanta commented Nov 2, 2019

Copy link
Owner

@DIYgod DIYgod left a comment

Choose a reason for hiding this comment

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

Please add docs

lib/routes/webtoons/naver.js Show resolved Hide resolved
@zfanta
Copy link
Contributor Author

zfanta commented Nov 10, 2019

I added docs.

const domain = 'https://comic.naver.com';

async function getDescription(link) {
const { body } = await got.get(link);
Copy link
Owner

Choose a reason for hiding this comment

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

should use cache for invariable content here, see: https://docs.rsshub.app/en/joinus/#enable-caching

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it. please check it.

const { body } = await got.get(link);
const $ = cheerio.load(body);
return $('#comic_view_area > div.wt_viewer').html();
result = $('#comic_view_area > div.wt_viewer').html();
ctx.cache.set(key, result, Number.POSITIVE_INFINITY);
Copy link
Owner

Choose a reason for hiding this comment

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

the third parameter Number.POSITIVE_INFINITY is not needed, there is a default value config.cache.contentExpire: https://github.com/DIYgod/RSSHub/blob/master/lib/middleware/cache.js#L46, controlled by external config

Number.POSITIVE_INFINITY -> config.cache.contentExpire
@DIYgod DIYgod merged commit aeb111c into DIYgod:master Dec 7, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants