It is currently April 28th, 2024, 4:55 pm

Little help request please RegEXP

Get help with creating, editing & fixing problems with skins
IcemanSR
Posts: 16
Joined: December 15th, 2011, 3:44 am

Little help request please RegEXP

Post by IcemanSR »

Please help this is confusing against all my logic :confused:
RainRegEXP :

Code: Select all

(?siU)all_info.*>(.*)</A>.*"ladestatus">(.*)\(\.*
result with :

Code: Select all

01=> mortalcomb72.Azx
02=> 20 % 
03=> SNTL_0710_HRALinks.info
04=> 2 % 
05=> Bizarre UK 2012
06=> 0 % 
07=> Nero.Burning.ROM.11.0.10500-P2P
08=> 100 % 
Which is all perfect just as i need it

But then in real time usage..

Code: Select all

[SOURCEJ]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=10
Url=http://JD:JD@127.0.0.1:8765
RegExp=(?siU)all_info.*>(.*)</A>.*"ladestatus">(.*)\(\.*

[ITEM1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[SOURCEJ]
StringIndex=01

[DL1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[SOURCEJ]
StringIndex=02
MaxValue=100

[ITEM2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[SOURCEJ]
StringIndex=3

[DL2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[SOURCEJ]
StringIndex=04
MaxValue=100
DL1&ITEM1 all good and nice
but all others are simply non responsive! :o

I am going nuts here,please advise why cant i parse string lines 2,3,4...
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Little help request please RegEXP

Post by jsmorley »

WebParser in Rainmeter is by nature and purpose "ungreedy", in that it only returns one (.*) StringIndex at a time, so we don't end up with runaway measures. RainRegExp (and Regular Expressions in general) are not. So you need to do this:

HTML:
<item>One</item>
<item>Two</item>

Rainmeter:
RegExp="(?siU)<item>(.*)</item>.*<item>(.*)</item>"

That will give you the two StringIndexes with the return values.

By the way, there is a shortcut that can save some typing:

[Variables]
Return=<item>(.*)</item>.*

[WebParserMeasure]
RegExp="(?siU)#Return##Return#"
IcemanSR
Posts: 16
Joined: December 15th, 2011, 3:44 am

Re: Little help request please RegEXP

Post by IcemanSR »

Thank you for your fast reply i understand now.
Altough now i have new problem :???:

parsing breaks or rather crashes when i use repeat 5 times

Code: Select all

RegExp="(?siU)#REGEX3##REGEX3##REGEX3##REGEX3#"
it will work in this form
but if i add another it breaks and don't produce any results from parse
same as this:

Code: Select all

RegExp=(?siU)all_info.*>(.*)</A>.*"ladestatus">(.*)\(\.*.*all_info.*>(.*)</A>.*"ladestatus">(.*)\(\.*.*all_info.*>(.*)</A>.*"ladestatus">(.*)\(\.*.*all_info.*>(.*)</A>.*"ladestatus">(.*)\(\.*
What am i still missing :confused:
I need to parse more then 4 lines
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Little help request please RegEXP

Post by jsmorley »

I'd need to see the raw html from the site. Either post a public link to the site if there is one, or use "view page source" and copy and past the raw html here in "" tags.
IcemanSR
Posts: 16
Joined: December 15th, 2011, 3:44 am

Re: Little help request please RegEXP

Post by IcemanSR »

here it is

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>JDownloader - WebInterface vJD Webinterface-9563</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<link rel="shortcut icon" href="favicon.png" type="image/png"/><link rel="icon" href="favicon.png" type="image/png"/>
<link href="jd.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="filelist.js"></script>
<script type="text/javascript" src="scripts.js"></script>
<noscript><meta http-equiv="refresh" content="0;URL=nojs.tmpl"></noscript>
</head>

<body onload="pageLoaded(); allowChars('maxdls', '01234567890'); allowChars('speed', '01234567890');">
<div id="main">
	<div id="header">
	<h2 class="title">WebInterface<br>(Version JD Webinterface-9563)</h2>
	</div>

	<div id="content">
		<div id="tabs">
			<ul id="tabmenu">

				<li class="active"><a class="active" href="index.tmpl" name="Status Page" target="_self">Status Page</a></li>
				<li class="unrarAvailable"><A href="passwd.tmpl" name="Edit Passwords" target="_self">Edit Password-List</A></li>
				<li><A href="link_adder.tmpl" name="Link Adder" target="_self">Add Links</A></li>
			</ul>
		</div>

		<div id="tabcontent">

			<FORM action="index.tmpl" name="jd" id="jdForm" method="POST" target="_parent">

				<div id="toolbar">
					<div id="toolbarright">
						<span class="toolbarButton" id="btnClose" title="Close JD" onclick="validateandsubmit('Close JD?','jdForm','bye.tmpl', 'close')"></span>
						<span class="toolbarButton" id="btnRestart" title="Restart JD" onclick="validateandsubmit('Restart JD?','jdForm','restart.tmpl', 'restart')"></span>
					</div>
					<div id="toolbarleft">
						<span class="toolbarButton" id="btnRefresh" title="Refresh Page" onclick="forwardto('index.tmpl')"></span>

						<span class="toolbarButton" id="btnDLstop" title="Start/Stop Downloads" onclick="submitForm('jdForm','index.tmpl','do', 'stop')"></span>
						<span class="toolbarButton" id="btnReconnect" title="Reconnect" onclick="submitForm('jdForm','reconnect.tmpl','do','reconnect')"></span>
						<span class="toolbarButton" id="btnAutoReconnect" title="Activate/Deactivate Auto-Reconnect" onclick="switchAutoReconnect('jdForm','index.tmpl','')"></span>
						<div class="hide"><input type="checkbox" name="autoreconnect" id="autoreconnect" value="on" ></div>
					</div>
					<div id="toolbarcenter">
						<span id="deactivatedAutoReloadSpace">&nbsp;</span> <!--Um Spruenge im Design beim IE6 zu vermeiden-->
						<span id="deactivatedAutoReload"><a href="index.tmpl">Auto-Reload<br>deactivated</a></span>

					</div>
					<br class="clear">
				</div>

				<div id="message_"><div><a href="#" class="button" onclick="closeMessage();">Close Message</a></div></div>

				<table class="tabledownload" id="packageContainer">
					<tr>
						<td style="width:2%;" class="tabletitle">

							<input type="checkbox" name="checkallbox" onclick="if (this.checked==true) {checkall(document.jd.package_all_downloads,document.jd.package_single_download); } else {uncheckall(document.jd.package_all_downloads,document.jd.package_single_download);}">
						</td>
						<td class="tabletitle">File</td>
						<td style="width:20%;" class="tabletitle">Hoster</td>
						<td style="width:300px;" class="tabletitle">Progress</td>
					</tr>


				
					<tr class="packagerunning">
						<td><INPUT type="checkbox" name="package_all_downloads" value="0" onclick="samecheckall(document.jd.package_single_download,this)"></td>
						<td><A href="all_info.tmpl?all_info=0" name="PackageInfo" onclick="return popup(this,600,200)">mortalcomb72.Azx</A></td>
						<td>1/1 Active</td>
						<td class="ladebalken">
							<div class="ladebalken">
								<div class="ladebalkenWrapper">
									<div name="ladebalken" class="running" style="width: 20%;" id="0">&nbsp;

									</div>
								</div>
								<span class="ladestatus">20 % (105.47 MB / 528.19 MB)</span>
								<br class="clear">
							</div>
						</td>
					</tr>

					
						<tr class="downloadrunning">

							<td><INPUT type="checkbox" name="package_single_download" value="0 0" onclick="areallsamechecked(this,document.jd.package_single_download,document.jd.package_all_downloads)"></TD>
							<td><A href="single_info.tmpl?single_info=0+0" name="LinkInfo" onclick="return popup(this,600,200)" style="padding-left: 20px;">mortalcomb72.Azx.rar</A></TD>
							<td>rapidshare.com</TD>
							<td class="ladebalken">
								<div class="ladebalken">
									<div class="ladebalkenWrapper">
										<div name="ladebalken" class="running" style="width: 20%;" id="0_0">&nbsp;
										</div>

									</div>
									<span class="ladestatus">20% Connecting...(1/1)</span>
									<br class="clear">
								</div></td>
						</tr>
					

				
					<tr class="packagerunning">
						<td><INPUT type="checkbox" name="package_all_downloads" value="1" onclick="samecheckall(document.jd.package_single_download,this)"></td>
						<td><A href="all_info.tmpl?all_info=1" name="PackageInfo" onclick="return popup(this,600,200)">SNTL_0710_HRALinks.info</A></td>

						<td>[1/1] ETA 4h:47m:50s @ 15.00 KB/s</td>
						<td class="ladebalken">
							<div class="ladebalken">
								<div class="ladebalkenWrapper">
									<div name="ladebalken" class="running" style="width: 28%;" id="1">&nbsp;
									</div>
								</div>
								<span class="ladestatus">28 % (96.99 MB / 349.98 MB)</span>

								<br class="clear">
							</div>
						</td>
					</tr>

					
						<tr class="downloadrunning">
							<td><INPUT type="checkbox" name="package_single_download" value="1 0" onclick="areallsamechecked(this,document.jd.package_single_download,document.jd.package_all_downloads)"></TD>
							<td><A href="single_info.tmpl?single_info=1+0" name="LinkInfo" onclick="return popup(this,600,200)" style="padding-left: 20px;">SNTL_0710_HRALinks.info.rar</A></TD>
							<td>megaupload.com</TD>

							<td class="ladebalken">
								<div class="ladebalken">
									<div class="ladebalkenWrapper">
										<div name="ladebalken" class="running" style="width: 28%;" id="1_0">&nbsp;
										</div>
									</div>
									<span class="ladestatus">28% ETA 4h:47m:50s @ 15.00 KB/s (1/1)</span>
									<br class="clear">

								</div></td>
						</tr>
					

				
					<tr class="packagerunning">
						<td><INPUT type="checkbox" name="package_all_downloads" value="2" onclick="samecheckall(document.jd.package_single_download,this)"></td>
						<td><A href="all_info.tmpl?all_info=2" name="PackageInfo" onclick="return popup(this,600,200)">Bizarre UK 2012</A></td>
						<td>1/1 Active</td>
						<td class="ladebalken">
							<div class="ladebalken">

								<div class="ladebalkenWrapper">
									<div name="ladebalken" class="running" style="width: 0%;" id="2">&nbsp;
									</div>
								</div>
								<span class="ladestatus">0 % (2.00 KB / 108.87 MB)</span>
								<br class="clear">
							</div>
						</td>

					</tr>

					
						<tr class="downloadrunning">
							<td><INPUT type="checkbox" name="package_single_download" value="2 0" onclick="areallsamechecked(this,document.jd.package_single_download,document.jd.package_all_downloads)"></TD>
							<td><A href="single_info.tmpl?single_info=2+0" name="LinkInfo" onclick="return popup(this,600,200)" style="padding-left: 20px;">Bizarre UK 2012-01.pdf</A></TD>
							<td>oron.com</TD>
							<td class="ladebalken">
								<div class="ladebalken">

									<div class="ladebalkenWrapper">
										<div name="ladebalken" class="running" style="width: 0%;" id="2_0">&nbsp;
										</div>
									</div>
									<span class="ladestatus">0% Connecting...(1/1)</span>
									<br class="clear">
								</div></td>
						</tr>

					

				
					<tr class="packagefinished">
						<td><INPUT type="checkbox" name="package_all_downloads" value="3" onclick="samecheckall(document.jd.package_single_download,this)"></td>
						<td><A href="all_info.tmpl?all_info=3" name="PackageInfo" onclick="return popup(this,600,200)">Nero.Burning.ROM.11.0.10500-P2P</A></td>
						<td></td>
						<td class="ladebalken">
							<div class="ladebalken">
								<div class="ladebalkenWrapper">
									<div name="ladebalken" class="running" style="width: 100%;" id="3">&nbsp;

									</div>
								</div>
								<span class="ladestatus">100 % (122.88 MB / 122.88 MB)</span>
								<br class="clear">
							</div>
						</td>
					</tr>

					
						<tr class="downloadfinished">

							<td><INPUT type="checkbox" name="package_single_download" value="3 0" onclick="areallsamechecked(this,document.jd.package_single_download,document.jd.package_all_downloads)"></TD>
							<td><A href="single_info.tmpl?single_info=3+0" name="LinkInfo" onclick="return popup(this,600,200)" style="padding-left: 20px;">Nero.Burning.ROM.11.0.10500-P2P.rar</A></TD>
							<td>filesonic.com</TD>
							<td class="ladebalken">
								<div class="ladebalken">
									<div class="ladebalkenWrapper">
										<div name="ladebalken" class="finished" style="width: 100%;" id="3_0">&nbsp;
										</div>

									</div>
									<span class="ladestatus">100%  > Extract OK</span>
									<br class="clear">
								</div></td>
						</tr>
					

				
				</table>

				<script type="text/javascript">
					// This must be placed immediately after the filelists (packages/downloads).
					initiate("statuslist");
					startPageReload(5);
					setProgressBarsColors('f5f502', '02CE02');
				</script>

				<div class="rightDLOptions">
					Max. Downloads <INPUT type="text" name="maxdls" id="maxdls" value="8" maxlength="4" size="4" onkeydown="formElementChanged()"> , SpeedLimit <INPUT type="text" name="speed" id="speed" value="15" maxlength="4" size="4" onkeydown="formElementChanged()"> KB/s (Current: 15 KB/s)</TD>
					<a href="#" class="button" onclick="submitForm('jdForm','index.tmpl','do','submit')">Go!</a>
				</div>

				<DIV class="leftDLOptions">

					<SELECT onchange="formElementChanged()" name="selected_dowhat_index">
					<option>activate</option>
					<option>deactivate</option>
					<option>reset</option>
					<option>abort</option>
					<option>remove</option>

					</SELECT>
					<a href="#" class="button" onclick="submitForm('jdForm','index.tmpl','do','submit')">Go!</a>
				</DIV>
				<br>
			</FORM>

			<h1>Add Links</h1>
			<FORM name="add" id="addForm" action="link_adder.tmpl" target="_parent" method="POST">

				<DIV class="linkAddBox">
					<div style="float:right;">
					<a href="#" onclick="submitForm('addForm','link_adder.tmpl','do','Add')" class="addButton">Add</a>
					</div>

					<div style="padding-right: 100px;">
					<textarea name="addlinks" cols="90" rows="3" onfocus="formElementChanged(); clean(this);" style="width:100%; float:left;">Paste your Links here (Container URLs, Link URLs, SourceCode from Pages to parse)</textarea>
					</div>

					<br class="clear">
				</DIV>
			</FORM>

			<h1>Upload container file</h1>
			<form name="upload" id="uploadForm" action="link_adder.tmpl" method="post" enctype="multipart/form-data">
				<div class="linkAddBox">
					<span style="color: #000; font-weight:bold;">Container upload:</span> <input name="container" type="file" size="50" onclick="formElementChanged()"> <a href="#" class="button" onclick="submitForm('uploadForm','link_adder.tmpl','do','Upload')">Upload!</a>

				</div>
			</form>
		</div>
	</div>
</div>
<div id="footer">PlugIn by jiaz, Design (HTML, CSS, JS) by Bo0nZ</div>
</body>
</html>

they are just some random links added for test
You do not have the required permissions to view the files attached to this post.
IcemanSR
Posts: 16
Joined: December 15th, 2011, 3:44 am

Re: Little help request please RegEXP

Post by IcemanSR »

ok i see what is the problem
it doesnt break actually at all.but if links are none existant in downloader parse will break
and instead of showing empty links it breaks all of it

how to prevent that?

example :
parser is made to parse 5 lines from download list
but if list has less then 5 parser will break and it wont produce any of them at all :o

lets say i delete that downloaded nero from jdownloader download list
result in rain plugin shold stay the same except empty spot for nero,but instead it breaks all of them and shows them as empty.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Little help request please RegEXP

Post by jsmorley »

Not sure I understand. There are only 4 instances of "all_info.tmpl" followed by ">" and then a name followed by </A>.

So

(?siU)all_info.*>(.*)</A>.*"ladestatus">(.*)\(.*all_info.*>(.*)</A>.*"ladestatus">(.*)\(.*all_info.*>(.*)</A>.*"ladestatus">(.*)\(.*all_info.*>(.*)</A>.*"ladestatus">(.*)\(.*

returns

Code: Select all

01=> mortalcomb72.Azx
02=> 20 % 
03=> SNTL_0710_HRALinks.info
04=> 28 % 
05=> Bizarre UK 2012
06=> 0 % 
07=> Nero.Burning.ROM.11.0.10500-P2P
08=> 100 % 
as I would expect, while adding a fifth one causes the regular expression to fail...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Little help request please RegEXP

Post by jsmorley »

Didn't see your last post...

We will need to use a "look ahead assertion". Give me a few to work one up for this.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Little help request please RegEXP

Post by jsmorley »

[Variables]
Get=(?(?=.*all_info.*>).*all_info.*>(.*)</A>.*"ladestatus">(.*)\()

RegExp="(?siU)#Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get#"

Should work fine no matter how many "occurrences" there are. StringIndexes where there is no occurrence will just return null.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Little help request please RegEXP

Post by jsmorley »

The format is basically:

(?(?=.*all_info.*>).*all_info.*>(.*)</A>.*"ladestatus">(.*)\()

(? [Do] (?= [If this is found] ) [stuff to Do] )

else continue without failing.

So it looks ahead for .*all_info.*> and if it is found, does .*all_info.*>(.*)</A>.*"ladestatus">(.*)\(

http://www.regular-expressions.info/lookaround.html