Remove text

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
sweborn
Posts: 12
Joined: 2007-10-17 23:16:52

Remove text

Post by sweborn »

How do i remove the text between <i style=" display: none;"> and </i> when i grab from the website discshop.se.
It is always a diffrent textstring so StringReplace dosn't works.
Is there a way to hide it in description?
I'm using the discshop.se script.
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

It should be possible to use "TextBetween" in a "StringReplace" function, so you don't need to know the exact string you want to replace.

Code: Select all

Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none;">', '</i>'),'');
But I do not find the code you mentioned in your posting on the films' details page.. can you give an example URL ? Or are you talking about the

Code: Select all

    <SCRIPT language="javascript" type="text/javascript">
		disableSelection(document.getElementById("text_handling"));
	</script>
part, that is imported into description field ?
sweborn
Posts: 12
Joined: 2007-10-17 23:16:52

Post by sweborn »

I got it to work. The website actual generate different codes on every updates. They really don't want anyone to copy it even if it's for private use.
Here is the code i use for "description":

Code: Select all

if CanSetField(fieldDescription) then
  begin
    Value := TextBetween(PageText,'Filmens handling:', '<BR>');
    if Value = '' then Value := TextBetween(PageText, 'Beskrivning:', '<BR>');
    Value := TextAfter(Value, '<br>');
    Value := StringReplace(Value, '    ', '');
    Value := StringReplace(Value, 'disableSelection(document.getElementById("text_handling"));', '');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display: none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display: none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display: none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display: none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display: none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display: none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display: none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display: none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display: none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display: none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span class="infoText1234">', '</span>'),'');
    Value := StringReplace(Value, '<FONT COLOR="white">i</FONT>', ' ');
    Value := StringReplace(Value, #13#10,'');
    Value := StringReplace(Value, #09,'');
    Value := StringReplace(Value, '<br>', #13#10);
    HTMLRemoveTags(Value);
    HTMLDecode(Value);
    SetField(fieldDescription, Value);
  end;
Thanks for your help bad4u
Post Reply