0

I am trying to make this work. Saving links in a .txt file based on a word/keyword match.

here is a code :

TAG POS=1 TYPE=h3 ATTR=class:r extract=htm
SET resultLink EVAL("var s='{{!EXTRACT}}';var match txt=\mmorpg\")
set !extract {{resultLink}}
SAVEAS TYPE=EXTRACT FOLDER=C:\tmp FILE=GameList.txt
set !extract null

But all I get is "__undefined__" in GameList.txt

Can someone help me? Thanks!

Ari0nhh
  • 5,720
  • 3
  • 28
  • 33
STHoney
  • 1
  • 1

1 Answers1

0

As I understood your comment and after looking at http://www.mmorpg.com/gamelist.cfm, the code, probably, must be like this:

SET !EXTRACT_TEST_POPUP NO
SET !LOOP 1
TAG POS={{!LOOP}} TYPE=TD ATTR=CLASS:alt EXTRACT=HTM
SET !EXTRACT EVAL("'{{!EXTRACT}}'.match(/http.*html/)[0];")
SAVEAS TYPE=EXTRACT FOLDER=C:\tmp FILE=GameList.txt

Play it in loop mode with the max loop value, say, 841 (the max row of the table with links).


Obsolete info:

Try the second line of your macro as follows:

SET resultLink EVAL("('{{!EXTRACT}}'.match(/mmorpg/)) ? '{{!EXTRACT}}' : 'no match!';")
Shugar
  • 5,269
  • 1
  • 9
  • 9
  • This is somehow working, but it saves everything from the source. I just want to save only the link ( exemple : http://www.mmorpg.com/gamelist.cfm ) in GameList.txt ! Nothing more, nothing less, just the link. Do you know what should I change ? Thanks! – STHoney Jul 14 '15 at 22:10
  • this is what it returns in GameList.Txt : `"

    Free MMORPG List and MMO Games - MMORPG.com

    "` ! So all I want is only the link to be saved , exemple the one from a href : http://www.mmorpg.com/
    – STHoney Jul 14 '15 at 22:42