Time for action – extracting a list of media links
There probably is a regular expression that would extract all of the "src" links from a page, but we're only interested in things that we know LiveCode is able to show or play. So this time we'll use a more devious way to extract just the links we can handle.
You may as well head over to the test stack!
Make a third button by duplicating one of the other two, and change the
getLinks
orgetText
part in the button script to callgetMedia
instead.In the stack script, enter all of this:
global gPageURL function getMedia pPageSource put ".jpg,.png,.gif,.jpeg,.mov,.mp4,m4v,.mp3" into tExtensions repeat with a = 1 to the number of items in tExtensions put item a of tExtensions into tExtension replace tExtension with tExtension & "*" & return in pPageSource end repeat repeat with a = the number of lines in pPageSource down to 1 put line a of pPageSource into tLine if the last char of tLine is "*" then ...