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

fix: link cannot be resolved #89 #90

Merged
merged 4 commits into from
Jun 14, 2023
Merged

fix: link cannot be resolved #89 #90

merged 4 commits into from
Jun 14, 2023

Conversation

kahosan
Copy link
Contributor

@kahosan kahosan commented Jun 12, 2023

fix: #89

@ndaidong ndaidong changed the base branch from main to dev June 14, 2023 01:48
@kahosan
Copy link
Contributor Author

kahosan commented Jun 14, 2023

maybe max-lines should be a bit longer?

@ndaidong
Copy link
Collaborator

ndaidong commented Jun 14, 2023

@kahosan thank you for your contribution.

What you committed are basically good in logic. However there is some issues with coding convention need to get fixed.

Also, I have other ideas for your code:

1, The variable named hostname is not very suitable

At least in the context of URL object in JavaScript, where hostname usually does not contain protocol.
In our case, it should be called baseUrl or something like that, to avoid confusion.

Screenshot from 2023-06-14 09-03-47

2, In the extract() method, parsing the hostname/baseUrl from feed url may lead to problem.

Sometimes the feed url may be different from the actual RSS resource. For example the feed urls from feedblitz, or feedburner. That's when the logic fails.

Let's try the following feeds:

3, In the extractFromJson() and extractFromXml() methods, you pass hostname/baseUrl via the third parameter, which is not the best way,

With 2 and 3, I recommend to use the parameter parserOptions for all methods, to keep thing simple and consistent.

For example:

extract('https://feeds.feedburner.com/MachineLearningMastery', {
  baseUrl: 'https://machinelearningmastery.com/',
})

4, You can make use of the method absolutify() in utils/linker.js

https://github.com/extractus/feed-extractor/blob/main/src/utils/linker.js#L12

@ndaidong
Copy link
Collaborator

max-lines

yes, you can increase that number in the eslint config file.

@kahosan
Copy link
Contributor Author

kahosan commented Jun 14, 2023

@ndaidong Should we let users fill in the baseUrl themselves?

@ndaidong
Copy link
Collaborator

@ndaidong Should we let users fill in the baseUrl themselves?

yes, I think so. We only use this when encountering non-standard feeds.

@ndaidong ndaidong merged commit 1d8d84c into extractus:dev Jun 14, 2023
4 checks passed
ndaidong added a commit that referenced this pull request Jun 14, 2023
- Merge pr #90 by @kahosan
- Update dependencies

Related issues: #89
@ndaidong ndaidong mentioned this pull request Jun 14, 2023
@ndaidong
Copy link
Collaborator

@kahosan I've released v6.2.3 with your latest updates. Thank you.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 5262712919

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.8%) to 84.296%

Totals Coverage Status
Change from base Build 5262148478: 0.8%
Covered Lines: 198
Relevant Lines: 198

💛 - Coveralls

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.

The link cannot be resolved when the hostname is not included
3 participants