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

API: includedKeywords does not work #235

Open
banner-prog opened this issue Aug 6, 2021 · 4 comments
Open

API: includedKeywords does not work #235

banner-prog opened this issue Aug 6, 2021 · 4 comments

Comments

@banner-prog
Copy link

The option includedKeywords does not work. The tool will scan for all links even when you want to scan links with only specific keywords.

@matkoniecz
Copy link

Can you give specific examples?

@banner-prog
Copy link
Author

Like, if I want to scan for broken links of facebook.com and github.com, I am meant to use the option includedKeywords. However, even if I use that, the tool will scan and give results of broken links such as example.com or instagram.com

@matkoniecz
Copy link

please give exact runnable code/command that triggers this bug - it needs to be done as the first step of resolving this bug

@banner-prog
Copy link
Author

Here is the code

var { SiteChecker } = require("broken-link-checker");
var URL = "https://www.github.com"
const siteChecker = new SiteChecker(
    { 
        excludeInternalLinks: true,
        excludeExternalLinks: false, 
        filterLevel: 1,
        acceptedSchemes: ["http", "https"],
        excludedKeywords: ["linkedin.com"],
        includedKeywords: ["facebook.com","instagram.com"],
       
    },
    {
        "error": (error) => {
            console.error(error);
        
        },

        "link": (result, customData) => {
            if(result.broken) {
                if(result.http.response && ![undefined, 200].includes(result.http.response.statusCode)) {
                    console.log(`${result.base.original} => ${result.url.original}`);
                }
            }            

        },

        "end": () => {
            console.log("COMPLETED!");
        }
    }
);


siteChecker.enqueue(URL);


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

No branches or pull requests

2 participants