Skip to content
Advertisement

Add https to missing strings of an array?

I’m writing an app for a client who doesn’t have an official API but wants the app to extract video links from his website so I wrote a logic using jsoup. Everything seems to work fine except some of the links don’t start with https so I’m trying to add it before the URL.

Here’s my code:

JavaScript

The website contains about 10 links per video but some links start like “//” instead of https.

This code adds the https but only for the first link it finds missing.

JavaScript

Advertisement

Answer

You need to iterate over your final array to apply your function to all links.

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