broken-link-checker icon indicating copy to clipboard operation
broken-link-checker copied to clipboard

Check a list of links

Open vkotovv opened this issue 7 years ago • 13 comments

Is there an option to check a list of links (not recursively)?

vkotovv avatar May 12 '17 15:05 vkotovv

Programmatic API: blc.UrlChecker for single links or blc.HtmlUrlChecker for a page with shallow/non-recursive links.

CLI: is not recursive by default and will check only the links on a single page

stevenvachon avatar May 12 '17 15:05 stevenvachon

@stevenvachon I mean, for CLI can I pass the list of links to blc or I should create a simple bash script for that?

vkotovv avatar May 12 '17 15:05 vkotovv

The CLI is currently for checking links within pages only.

stevenvachon avatar May 12 '17 15:05 stevenvachon

Sorry for misleading you, I mean list of pages also. Is that possible?

vkotovv avatar May 12 '17 16:05 vkotovv

The CLI currently only supports one URL input. A PR is welcome.

stevenvachon avatar May 12 '17 18:05 stevenvachon

This has been implemented in the v0.8 branch.

stevenvachon avatar May 16 '17 02:05 stevenvachon

Hi @stevenvachon , this would be a great feature, Thank you! From the commits it seems that this is still work in progress, correct?

Andrea-borg avatar Jun 02 '17 19:06 Andrea-borg

@Andrea-borg v0.8.0 has not yet been released. The feature works in that pre-release, though.

stevenvachon avatar Jun 02 '17 19:06 stevenvachon

Oh that's great, Thank you @stevenvachon May you please give an example of how this argument should be passed in the command line please? Something like this maybe? : node bin/blc file://urls.txt

Andrea-borg avatar Jun 02 '17 19:06 Andrea-borg

file:// is not yet working in that branch.

blc http://site1/ http://site2/

stevenvachon avatar Jun 02 '17 21:06 stevenvachon

@Andrea-borg I use a simple bash script that reads links from the file line by line:

#!/bin/bash
FILE=links.txt

while read CMD; do
    echo "$CMD"
    blc "$CMD"
done < "$FILE"

vkotovv avatar Jun 05 '17 08:06 vkotovv

Thank you @vkotovv :)

Andrea-borg avatar Jun 05 '17 14:06 Andrea-borg

@Andrea-borg, another solution:

const shell = require('shelljs');

const urls = ['https://ukr.net', 'https://meta.ua'];

urls.forEach((el) => {
  shell.exec(`npx blc ${el} -reo`);
});

ko4ergins avatar Jul 07 '19 10:07 ko4ergins