# Web Sources Framework: Help needed

**URL:** https://community.mp3tag.de/t/web-sources-framework-help-needed/10944
**Category:** Web Sources Discussion
**Created:** [October 14, 2010, 11:47am UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944 "2010-10-14T11:47:53Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![sundance](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sundance/32/11_2.png) [@sundance](https://community.mp3tag.de/u/sundance)
#### Post date: [October 14, 2010, 11:47am UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/1 "2010-10-14T11:47:53Z")

</div>

Hello,

I would like to iterate through a HTML table that looks like this:

```
.
.
<table>
  <tr>
    <td>Info 1a</td>
    <td>Info 1b</td>
  </tr>
  <tr>
    <td>Info 2a</td>
    <td>Info 2b</td>
  </tr>  
</table>
.
.

```

(there could be blank lines in between, also)

I tried with something like this:

```
findline "<table">
do
  findline "<tr>"
    findline "<td>"
    findinline "<td>"
    sayuntil "</td>"
  findline "</tr>"
  say "|"

  findline "<tr>"
    findline "<td>"
    findinline "<td>"
    sayuntil "</td>"
  findline "</tr>"
  saynewline
until ??? 

```

How would you create the until condition?

.sundance.

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [October 14, 2010, 1:15pm UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/2 "2010-10-14T13:15:29Z")

</div>

I don't think there is a "do ... until" command. Would be usefull, but i have never seen it. If it is, please tell me.

Instead there is "do ... while" which requires that there is always the same text before the information like

.  
The proplem with the blank lines is easy to handle with a command.

You want output lilke this:

Info 1a | Info 1b  
Info 2a | Info 2b

so i would try: findline "

"

```
joinuntil "</table>"
regexpreplace "</td><td>" " \| "
regexpreplace "</tr><tr>" "\r\n"
regexpReplace "<(.*?)>" ""
sayrest
```

---

<div class="post-metadata">

### Author: ![sundance](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sundance/32/11_2.png) [@sundance](https://community.mp3tag.de/u/sundance)
#### Post date: [October 14, 2010, 5:55pm UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/3 "2010-10-14T17:55:28Z")

</div>

Hello pone,

thanks for your replies!  
And yes, you're right, there's no "until", it's a do/while loop...

Nice idea to do it with regexes, but it's not as easy as in my example, which I tried to simplify (too much, I guess...)

The actual output looks like this:

```
.
.
  <tr class="significant">
    <td class="relevance text-center">
      <div class="bar" style="width:100%" title="100%"></div>
    </td>

    <td class="text-center">
      <a href="[some link]"><img src="[some pic]" width="9px" height="10px"></a>
    </td>

    <td><a href="http://[some album url]">Post Card</a></td>

    <td>Mary Hopkin</td>

    <td>Toshiba EMI</td>

    <td>1969</td>

    <td>Pop/Rock</td>
  </tr>
.
.

```

From the first

 only "100%" is needed,  
the second must be discarded,  
from the 3rd I need the URL and the album title "Post Card"  
and the remaining 4 I need completely, so my result string is:

"100|[some album url]|Post Card|Mary Hopkin|Toshiba EMI|1969|Pop/Rock"

(I can't specify the name of the web site this script is intended for (but it's not difficult to guess...), since it's somehow "uncorrect" to run scripts against their web site. But lately they changed their code and so there's work to do...)

By now, I'm able to collect all the information needed for the indexpage, but my do/while loop won't work. Maybe I have to reconstruct it to find a proper "while" condition.

.sundance.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [October 14, 2010, 6:16pm UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/4 "2010-10-14T18:16:48Z")

</div>

findline "

" 1 1  
unspace  
while ""

---

<div class="post-metadata">

### Author: ![sundance](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sundance/32/11_2.png) [@sundance](https://community.mp3tag.de/u/sundance)
#### Post date: [October 18, 2010, 1:05pm UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/5 "2010-10-18T13:05:55Z")

</div>

dano,

thanks for the hint, you made my day...  
Meanwhile I managed to to fill the index page properly.

Being the regex specialist that you are, it's probably a no-brainer for you to help me with my next problem:  
In the [ParserScriptAlbum] section I'm trying to enumerate the tracks and their composers/artists from the web site in question ([www.dummy.com](http://www.dummy.com)). I get this result:

```
.
.
<td id="expand-title" class="cell">
  <a href="http://www.dummy.com/artist/blackmore-p15867">Blackmore</a>, <a href="http://www.dummy.com/artist/gillan-p4366">Gillan</a>, <a href="http://www.dummy.com/artist/glover-p17896">Glover</a>, <a href="http://www.dummy.com/artist/lord-p19001">Lord</a>&hellip;</td>
.
...

```

To extract the list of composers, I tried with "SayRegExp":

```
SayRegExp "(?<=<a href=.+>)[^<]+(?=</a>)" ", " "</td>"

```

But all I get is an error message:

```
Script-Line : 236
Command : sayregexp
Parameter 1 : >(?<=<a href=.+>)[^<]+(?=</a>)<
Parameter 2 : >, <
Parameter 3 : ></td><

Output : >Regular expression

Invalid lookbehind assertion encountered in the regular expression.<

```

I checked my regex with [this tool](http://www.radsoftware.com.au/regexdesigner/), which delivers the result I expect.  
-\> I'm clueless...

.sundance.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [October 18, 2010, 1:42pm UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/6 "2010-10-18T13:42:40Z")

</div>

Mp3tag regex is based on PERL regex. So the lookbehind has limitations, i.e. it needs a fixed width.  
In (?\<=) you can't use .+

.NET regex is a bit more powerful that's why it works in your test tool.

---

<div class="post-metadata">

### Author: ![sundance](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sundance/32/11_2.png) [@sundance](https://community.mp3tag.de/u/sundance)
#### Post date: [October 19, 2010, 5:29am UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/7 "2010-10-19T05:29:20Z")

</div>

dano,

thank you very much for your valuable feedback.  
Now it works. I added another RegexpReplace to be able to supply a fixed width lookbehind parameter:

```
.
RegexpReplace "<a href=\x22http://www.dummy.com/artist/.+?\x22>" "<ax>"
.
OutputTo "Composer"
SayRegExp "(?<=<ax>)[^<]+(?=</a>)" ", " "</td>"

```

(to be continued when the next issue surfaces...)

.sundance.

---

<div class="post-metadata">

### Author: ![sundance](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sundance/32/11_2.png) [@sundance](https://community.mp3tag.de/u/sundance)
#### Post date: [October 20, 2010, 4:57am UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/8 "2010-10-20T04:57:02Z")

</div>

@Admin,  
I was trying to upload a file here (an XML file) but it was not possible. Do I need a special permission to do so?

Solved:  
[Notepad\_\_\_mp3tag.zip](https://community.mp3tag.de/uploads/default/original/2X/a/a7a98e977acabe3ba0ade28d3c2b2e136da50bbe.zip) (905 Bytes)  
Thanks for the hint, DetlevD.  
I uploaded a language extension for (my favourite) text editor Notepad++, which enables syntax highlighting for WebSources Framework. I find it quite useful, because you'll instantly see typos, when you create/edit your .src files.

.sundance.

[Notepad\_\_\_mp3tag.zip](https://community.mp3tag.de/uploads/default/original/2X/a/a7a98e977acabe3ba0ade28d3c2b2e136da50bbe.zip) (905 Bytes)

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [October 20, 2010, 5:10am UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/9 "2010-10-20T05:10:30Z")

</div>

> [@sundance](#):
>
> @Admin,I was trying to upload a file here (an XML file) but it was not possible. Do I need a special permission to do so?

I am not "@Admin", but ...  
... what is when you rename the file to e. g. "YourXMLFile.xml.txt" or pack the file into a zip package?

DD.20101020.0910.CEST

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 12, 2022, 9:00am UTC](https://community.mp3tag.de/t/web-sources-framework-help-needed/10944/10 "2022-01-12T09:00:45Z")

</div>

I have [here](https://community.mp3tag.de/t/web-sources-framework-syntax-highlighting-for-notepad/55863) added my UDL version with detailed instructions.
