Recent Changes - Search:

LiveStreamsPro

PmWiki

pmwiki.org

edit SideBar

Listrepeat

The list in regex functionality generates repeated item entries automatically.

Many times, we get a regex working for single channel/video and everything is ok, we copy paste the same regex and change the channelid or name, image etc and repeat it for every channel. So what if, we can provide a regex that will fetch all the channels and the same single channel regex work for each channel by replacing each parameter which is different.

To repeat this regex for each channels, which is available on the main site, these are the steps.

1. write a regex that returns all the channels name, channel id and images or anything we want to change.\\Test it to make sure its working, use online tool like https://regex101.com/ for example.
Code:

<regex>
<name>makelist</name>
<expres>\s.a href=".*stream=(.*?)".(.*?)./</expres>
<page>http://www.meocanaltv.com/</page>
<cookieJar></cookieJar>
</regex>
it should return two dimensional array. Each column will be referenced as param1, param2 and so on. also param0 is avaiable (since 2.0.1) which would be just a row number sequence.

2. Add listrepeat items to this list regex, it should contain whatever you want to repeat for each entry, it could contain all normal tags we add to the xml, other than the regexes itself. Since it will be xml inside the xml use the CData so that you dont have to format the xml.
Code:

<listrepeat><![CDATA[
   <title>[makelist.param2]</title>
   <link>$doregex[get-rtmp] playpath=$doregex[get-playpath] swfUrl=http://pxstream.tv/player510.swf live=1 pageUrl=http://pxstream.tv/embedrouter.php?file=$doregex[get-cid] timeout=10</link>
   <thumbnail>NA</thumbnail>
]]></listrepeat>
As you can see, the format is [regexname.paramNumber]

3. Call the list regex from the link
Code:

<link>$doregex[makelist]</link>
4. add other regex from single regex and change anything static to dynamic params for example
Code:
<regex>
    <name>get-rtmp</name>
    <expres>streamer: '(.*?)'</expres>
    <page>http://pxstream.tv/embedrouter.php?file=$doregex[get-cid]</page>
    <referer>http://www.meocanaltv.com/canais.php?stream=[makelist.param1]</referer>
</regex>
<regex>
    <name>get-playpath</name>
    <expres>file: '(.*?)'</expres>
    <page>http://pxstream.tv/embedrouter.php?file=$doregex[get-cid]</page>
    <referer>http://www.meocanaltv.com/canais.php?stream=[makelist.param1]</referer>
</regex>
<regex>
    <name>get-cid</name>
    <expres>file='(.*?)'</expres>
    <page>http://www.meocanaltv.com/embed/[makelist.param1].php?width=600&amp;height=450</page>
</regex>
Here is the complete regex.
Code:
<item><title>portalnacional new</title><link>$doregex[makelist]</link><regex><name>makelist</name><listrepeat><![CDATA[
  <title>[makelist.param2]</title>
  <link>$doregex[get-rtmp] playpath=$doregex[get-playpath] swfUrl=http://pxstream.tv/player510.swf live=1 pageUrl=http://pxstream.tv/embedrouter.php?file=$doregex[get-cid] timeout=10</link>
  <thumbnail>NA</thumbnail>
]]></listrepeat><expres>\s.a href=".*stream=(.*?)".(.*?)./</expres><page>http://www.meocanaltv.com/</page><cookieJar></cookieJar></regex><regex><name>get-rtmp</name><expres>streamer: '(.*?)'</expres><page>http://pxstream.tv/embedrouter.php?file=$doregex[get-cid]</page><referer>http://www.meocanaltv.com/canais.php?stream=[makelist.param1]</referer></regex><regex><name>get-playpath</name><expres>file: '(.*?)'</expres><page>http://pxstream.tv/embedrouter.php?file=$doregex[get-cid]</page><referer>http://www.meocanaltv.com/canais.php?stream=[makelist.param1]</referer></regex><regex><name>get-cid</name><expres>file='(.*?)'</expres><page>http://www.meocanaltv.com/embed/[makelist.param1].php?width=600&amp;height=450</page></regex><thumbnail>http://portalnacional.com.pt/images/icons/tv/PORTO.png</thumbnail></item>

You can use the same concept to display multiple links dynamically. say the page returns multiple urls, you can use the list functionality to fetch all of those links and chose which one to play. OR something like this where its picking up the xml and creating channels, which doesn't require regex but you wont want to keep updating the links manually all the time.

You can use the <listrepeat> tag which will contain whatever you want to repeat on every line.
Code:

<item>
<title>portalnacional new</title>

<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
   <title>[makelist.param2]</title>
   <link>$doregex[get-rtmp] playpath=$doregex[get-playpath] swfUrl=http://pxstream.tv/player510.swf live=1 pageUrl=http://pxstream.tv/embedrouter.php?file=$doregex[get-cid] timeout=10</link>
   <thumbnail>NA</thumbnail>
]]></listrepeat>

<expres>\s.a href=".*stream=(.*?)".(.*?)./</expres>
<page>http://www.meocanaltv.com/</page>
<cookieJar></cookieJar>
</regex>

<regex>
<name>get-rtmp</name>
<expres>streamer: '(.*?)'</expres>
<page>http://pxstream.tv/embedrouter.php?file=$doregex[get-cid]</page>
<referer>http://www.meocanaltv.com/canais.php?stream=[makelist.param1]</referer>
</regex>

<regex>
<name>get-playpath</name>
<expres>file: '(.*?)'</expres>
<page>http://pxstream.tv/embedrouter.php?file=$doregex[get-cid]</page>
<referer>http://www.meocanaltv.com/canais.php?stream=[makelist.param1]</referer>
</regex>

<regex>
<name>get-cid</name>
<expres>file='(.*?)'</expres>
<page>http://www.meocanaltv.com/embed/[makelist.param1].php?width=600&amp;height=450</page>
</regex>

<thumbnail>http://portalnacional.com.pt/images/icons/tv/PORTO.png</thumbnail>
</item>
for examples where there is no regex, its still same,
Code:
<item>
<title>tamil xml</title>

<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
   <title>[makelist.param1]</title>
   <link>[makelist.param2]|User-Agent=Apache-HttpClient</link>
   <thumbnail>[makelist.param3]</thumbnail>
   ]]></listrepeat>
<expres>&lt;name&gt;(.*?)&lt;.*\s*&lt;link&gt;(.*?)&lt;.*\s*&lt;image&gt;(.*?)&lt;</expres>
<page>http://entepanayi.weebly.com/uploads/1/0/6/7/10670567/tamil.xml</page>
<cookieJar></cookieJar>
</regex>
</item>

However, let me stress on a problem related to list repeat (you example is correct and this doesn't apply there). The result of regex for List Repeat should always be normal characters like You&me or this<that etc not escape chars (like &amp because LSPro will always do the escaping for you.

Edit - History - Print - Recent Changes - Search
Page last modified on February 25, 2016, at 05:47 PM