Skip to content
Advertisement

Extract links from a list of urls

I am trying to extract all the links from a set list of or urls in a text file and save the extracted links in another text file. I am trying to use the script below which was originally meant to extract Emails:

I changed the the email extract part

JavaScript

to extract links like this:

JavaScript

Here is the full code:

JavaScript

The problem i have with this is that it is supposed to get all links from a list of urls but it only scanned the first link and ignored the rest. I have 30 links that i want to extract from, how can i make the above code work?

Advertisement

Answer

you must using trim() at the url..
try add trim on your code

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement