Extract a part of a TITLE and open it in a url?

2019-03-06 23:13发布

问题:

I'm using iMacros.

Inspect Element show me this:

<a class="avatar " title="designperks's Instagram Profile" alt="designperks's Instagram Profile" href="/app/users/ig-1451494389/designperks/photos"

What I want to do is extract what's in TITLE until the apostrophe and open it in instagram.com, in this example it's designperks here is what I came up with:

SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
SET !TIMEOUT_STEP 2
TAB T=1
TAG POS={{!LOOP}} TYPE=A ATTR=TITLE:* EXTRACT=TITLE
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.split(\"'\",\"\"); ")
SET !EXTRACT NULL
SET !EXTRACT {{!VAR1}}
TAB OPEN
TAB T=2
URL GOTO=http://instagram.com/{{!VAR1}}

I'm almost done, but I know that there is a mistake here (\"'\",\"\"); ") and I can't figure it out.

Many thanks!

回答1:

you could use jQuery.

$().ready(function() {
    alert($(".avatar").attr("title"));  
);

But I'm not sure if that's 'imactos' relevant.



回答2:

How could I always extract the 4th element in HREF?

HREF:/app/users/*/*/photos