Im trying to extract lots of information from a website, and Im unfamiliar with the syntax I should use to get specific content, I've tried reading up on RegEx and match API for actionscript 3, but Im still unsure.
This is my code:
var l1:URLLoader = new URLLoader();
l1.addEventListener(Event.COMPLETE, completeHandler);
l1.load(new URLRequest("https://meny.no/oppskrifter/Pasta/baked-feta-pasta/"));
trace("load");
function completeHandler(e:Event):void {
trace("complete")
var s:String = e.target.data;
//var targets:Array = s.match(/(?<=<div class="target">).*(?=<\/div>)/igm);
trace(targets);
//getting the name of the recipe
var targets:Array = s.match(/(?<=<h1 class="c-h1">).*(?=<\/h1>)/igm);
trace(targets);
// getting the ingress of the recipe
targets[1] = s.match(/(?<=<div class="c-recipe__intro">).*(?=<\/div>)/sigm);
trace(targets[1]);
trace("complete2");
}
What I'm trying to grep with this line:
targets[1] = s.match(/(?<=).*(?=</div>)/sigm);
Is getting this information only: Oppskrift på TikTok trenden "Baked feta pasta", en enkel pasta med saus av ovnsbakt fetaost og tomater. Retten er enkel med få ingredienser og mye smak. Fetaost, tomater, olivenolje og urter ovnsbakes, og blandes så med kokt pasta.
But instead it gives me everything after aswell Anyway, is there a template or something that explains how to get certain information in a more graspable way? Thanks!
Its similar to this question: But not quite the same
In swf AS3, how do you extract string content from a website