iMacro on extract hyperlink within a region of text

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
baokydev
Posts: 2
Joined: Thu Oct 31, 2013 1:51 pm
Contact:

iMacro on extract hyperlink within a region of text

Post by baokydev » Thu Oct 31, 2013 1:52 pm

iMacro on extract hyperlink within a region of text

$data = inbtwn($getpage,"Episode name","<div id=\"rightside\">");
preg_match_all( '/<\s*A[^>]HREF="(.*?)"\s?(.*?)>/i', $data, $match);

Assuming get page is a HTML Source Code

Episode name is the start of the cut
<div id="rightside"> is the end of the cut

All the hyperlink in between this "Episode name" & "<div id="rightside">"
can it be extract and run in a for loop for my this code

**and the value of each hyperlink is replace at the "EACH_LINK[ARRAY]"**

for amount of hyperlinks
{
VERSION BUILD=8510617 RECORDER=FX
TAB T=1
URL GOTO=EACH_LINK[ARRAY]
SAVEAS TYPE=CPL FOLDER=C:\savedpage FILE=+_{{!NOW:yyyymmdd_hhnnss}}
}

**Thanks for helping !!**

The html code is something like this



<span class='st_sharethis_hcount' displaytext='ShareThis'></span>
<script type="text/javascript"> var switchTo5x = true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
</div>

<div class="clear">
&nbsp;</div>

<div style="text-align: center">
<img src="/Content/images/download.png" style="vertical-align: middle; margin-top: -5px" />&nbsp;
<a class="bigChar" style="font-size: 23px;" href="/DownloadCategory/galf">
Click here to download all</a>
</div>
<div class="clear">
&nbsp;</div>
<table class="listing">
<tr>
<th width="85%">
Page name
</th>
<th width="15%">
Day Added
</th>
</tr>
<tr style="height: 10px">
</tr>

<tr>
<td>
<a href="/Category/galf/Page-013?id=19881"
title="View Category galf Page 013">
galf Page 013</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-012?id=19880"
title="View Category galf Page 012">
galf Page 012</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-011?id=19879"
title="View Category galf Page 011">
galf Page 011</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-010?id=19878"
title="View Category galf Page 010">
galf Page 010</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-009?id=19877"
title="View Category galf Page 009">
galf Page 009</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-008?id=19876"
title="View Category galf Page 008">
galf Page 008</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-007?id=19875"
title="View Category galf Page 007">
galf Page 007</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-006?id=19882"
title="View Category galf Page 006">
galf Page 006</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-005?id=19874"
title="View Category galf Page 005">
galf Page 005</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-004?id=19873"
title="View Category galf Page 004">
galf Page 004</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-003?id=19872"
title="View Category galf Page 003">
galf Page 003</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-002?id=19871"
title="View Category galf Page 002">
galf Page 002</a>
</td>
<td>
1/12/2013
</td>
</tr>

<tr>
<td>
<a href="/Category/galf/Page-001?id=19870"
title="View Category galf Page 001">
galf Page 001</a>
</td>
<td>
1/12/2013
</td>
</tr>

</table>

</div>
</div>
</div>
</div>
<div id="rightside">
<div class="rightBox">
<div class="barTitle">
Cover</div>
<div class="barContent">
<div class="arrow-general">
&nbsp;</div>
<div style="text-align: center">
<img width="190px" height="250px" src="http://Category.com/Uploads/2942272.jpg" />
</div>
</div>
</div>
<div class="clear2">
</div>
<div class="rightBox">
<div class="barTitle">
Related Links</div>
<div class="barContent">
<div class="arrow-general">
&nbsp;</div>

<div>
<img src="../../Content/images/bullet.png" />&nbsp;<a href="/Category/galf/Page-014" title="View galf Page 014 online">galf 014</a><div class="clear" style="height:5px"></div>
</div>
</div>
</div>
<div class="clear2">
</div>
<div class="rightBox">
<div class="barTitle">
Comments</div>
<div class="barContent">
<div class="arrow-general">
&nbsp;</div>
<div>
<div class="fb-comments" data-href="http://Category.com/Category/galf" data-num-posts="2"
data-width="200" data-colorscheme="dark">
</div>
</div>
</div>
</div>
</div>
</div>
<div style="height: 30px" class="clear">
&nbsp;</div>

<!-- end div container -->
<div class="clear">
&nbsp;</div>
<div class="clear">
&nbsp;</div>
<div class="clear">
&nbsp;</div>


And I wish to get the 12 hyperlinks between

"Episode name" & "<div id="rightside">"
Coding is fun.
Post Reply