Autor Beitrag
DiamondDog
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Mi 26.11.08 13:11 
Hallo Leute,
ich hab zwar schon einwenig gegoogelt aber irgend wie nich das gefunden, was ich gesucht habe und zwar würd ich gerne aus diesem Quelltext:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>DiamondDog</title>
<meta name="Description" content="Die Private Homepage von DiamondDog mit Partyfotos Gabber-Infos Linkliste Wallpaper und vielem mehr">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta name="Keywords" content="Fotos, Fotogalerie, Party, Partys, Partyfotos, Fotos, Gabber, Techno, Terror, Hardcore, Speedcore, Wallpaper, Hintergrundbilder, Partyz, Feten, Feiern, Toplist, Linkliste, Links, QIP, Infium, Inf, Infinium">
<link href="http://diamonddog.jeak.de/style/bilder/pfote.ico" rel="SHORTCUT ICON">
<meta name="ROBOTS" content="index,follow">
<META name="LANGUAGE" content="deutsch,german,DE,AT,CH">
<meta name="DISTRIBUTION" content="global">
<link href="/ad/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table cellspacing="0" cellpadding="0" id="main">
<tr><td id="cnt"><iframe src="http://diamonddog.jeak.de/" name="fid1" id="fid1" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0"></iframe></td></tr>
</table>
<div align="center" id="bottom">
<h1><a href="diamonddog.de.tt">DiamondDog</a></h1><br><br>
<h2><a href="http://diamonddog.jeak.de/">Die Private Homepage von DiamondDog mit Partyfotos Gabber-Infos Linkliste Wallpaper und vielem mehr</a></h2><br><br>
</div>
</body>
<!-- FC:f -->
</html>
diese Stelle hier auslesen:
ausblenden Quelltext
1:
<a href="http://diamonddog.jeak.de/">					
bzw geht es mir nur um die http Adresse, kann mir jemand sagen wie ich diese aus dem Quelltext filtern kann?

Danke schon mal.

Mfg Dog
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 26.11.08 13:34 
Entweder benutzt du einen richtigen HTML-Parser, von denen es im Internet jede Menge gibt, oder du suchst einfach mit Pos z.B. nach <h2><a href=" und kopierst mit Copy den folgenden Teil heraus. Mit PosEx kannst hinter diesem Vorkommen zum Beispiel nach "> suchen um die Länge der zu kopierenden Stelle zu berechnen.
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Mi 26.11.08 13:54 
also habs es biß jetzt so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
var
  StrStart : Integer;
  a,b : integer;
begin
Label1.Caption  := GetHTML('http://www.diamonddog.de.tt');
a := pos('<h2><a href="',Label1.Caption);
b := PosEx( '">', a, Label1.Caption);
Label2.Caption:= inttostr(a)+' '+inttostr(b);
end;
leider hab ich das Problem das ich jetzt die Fehlermeldung bekommen:
Undefninierter Bezeichner: 'PosEx'

Edit: Fehler hat sich erledigt hatte vergessen:
StrUtils in die uses einzubinden

Edit:
Hab immer noch ein Problem und zwar wird mir jetzt alles nach der http Adresse ausgegeben weil mit PosEx nen falschen Wert liefert so sieht der Code aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
var
  a,b : integer;
begin
Label1.Caption  := GetHTML('http://www.diamonddog.de.tt');
a := pos('<h2><a href="',Label1.Caption);
b := PosEx( '">', Label1.Caption, a);
Label2.Caption:= inttostr(a)+' '+inttostr(b);
Label3.Caption := Copy(Label1.Caption, a+13, b);
end;


Edit:
Hab es nach einer kleinen Überlegeung jetzt doch hinbekommen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
var
  a,b : integer;
begin
Label1.Caption  := GetHTML('http://www.diamonddog.de.tt');
a := pos('<h2><a href="',Label1.Caption);
b := PosEx( '">', Label1.Caption, a);
Label2.Caption:= inttostr(b-a);
Label3.Caption := Copy(Label1.Caption, a+13, b-13-a);
end;