Autor Beitrag
dm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: So 06.04.03 14:28 
Hallo,

ich schreib grad an nem eigenen kleinen Browser, der die möglichkeit bietet, alle Bilder die auf dem angewählten server hinterlegt sind automatisch runterzuladen.

Jemand ne ahnung wie das geht?

Gruß DM
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: So 06.04.03 16:15 
Hi,
ich denk da kannst du nur die ganze Seite phrasen und dann die Bilder nehmen und saugen :)

MfG BungeeBug
dm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: So 06.04.03 16:26 
Titel: und wie ? :)
Für gaaanz doofe : wie geht n das?

kannst du vielleicht kurz n beispiel-quellcode posten?

Wäre nett

gruß DM
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: So 06.04.03 17:19 
sorry kann ich nicht ... dann wärs schon erledigt :) ausserdem hab ich im mom nicht die zeit und die lust das zu probiern .. aber frag mal nen paar andere hier

MfG BungeeBug
mars
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 238

Debian Woody, Win 2000, Win XP
D7 Ent, Kylix 3
BeitragVerfasst: So 06.04.03 18:56 
Einen Beispielcode habe ich zwar nicht, aber ich kann dir BungeeBugs Vorschlag ein ganz wenig ausführlicher erklären:
Du lädst dir also die betreffende Seite runter und suchst im Source davon nach einem Image-Tag. Dieser könnte beispielsweise folgendermassen aussehen: <img src="images/smiles/icon_biggrin.gif" border="0" alt="Very Happy" title="Very Happy" />
Was du also brauchst, ist die Adresse (images/smiles/icon_biggrin.gif). Du suchst also nach dem nächsten Anführungszeichen und kopierst den String bis zum übernächsten Anführungszeichen. Damit hast du die Adresse und kannst dich daran machen, das Bild runterzuladen.
Inwiefern das bei durchschnittlichen Websites klappt, weiss ich nicht. Da gibts sicher Leute mit mehr Erfahrung. Vielleicht gibt es auch eine viel einfachere Variante als die von BungeeBug?
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 07.04.03 18:59 
www.jazarsoft.com/products/9.php

da gibts ne kompo, die einen HTML quelltext auf alles mögliche durchparsen kann.

die liefert die dir Bild URLS zurück. die lädst du dann einfach mal runter

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Benni42
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Mo 14.04.03 23:58 
Servus!

Ich hab einen Freeware-Browser geschrieben (www.dxbrowser.de); daraus mal ein Code-Schnipsel, der genau das macht, was Du willst.
Hier mußt Du nix parsen, denn über das Document bekommst Du eine Liste aller Images inkl. URL. :)

Der Typ TEmbeddedWB gibts bei
www.euromind.com/iedelphi

(DIE Freeware-Komponente für Browser, zehnmal besser als TWebBrowser)

Der Code, wie er hier ist, behandelt auch Seiten mit Frames! :D

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
procedure TMainForm.GetAllBrowserPicsActionExecute(Sender: TObject);

   procedure SaveAllPics(PathToImages: String; Document: IDispatch);
      var I, Count: Integer;
       S, S2: String;
   begin
      Try
         If Assigned(Document) Then Begin
            Count := Variant(Document).Images.Length - 1;
            For I := 0 To Count Do Begin
               S   := Variant(Document).Images.Item(I).Src;
               S2 := PathToImages + '\' + Variant(Document).Images.Item(I).nameProp;
               URLDownloadToFile(Nil, PChar(S), PChar(S2), 0, Nil);
               Application.ProcessMessages;
            End;
         End;
      Except
      End;
   end;

var I, Count: Integer;
    E: TEmbeddedWB;
    PathToImages: String;
    F: TInfoForm;
    Web: IWebBrowser2;
begin
  Try
      E := BList.GetActive; // liefert die aktuelle Browser-Instanz zurück, also bei Dir z.B. WebBrowser1
      If (E = Nil) Then Exit;
      If (E.OleObject.Document.Images.Length - 1 > 0) Or (E.FrameCount > 0) Then Begin
         PathToImages := BrowseDialog('Wähle den Zielordner für die Browserbilder:', BIF_NEWDIALOGSTYLE);
         If (Trim(PathToImages) = '') Then Exit;
         If (Not DirectoryExists(PathToImages)) Then Begin
            MessageDlg('Das Verzeichnis ''' + PathToImages + ''' existiert nicht!', mtError, [mbOK], 0);
            Exit;
         End;
         Screen.Cursor := crHourglass;
         Try
          If (E.FrameCount > 0) Then Begin
                    Count := E.FrameCount - 1;
                 For I := 0 To Count Do Begin
                       Web := E.GetFrame(I);
                      If (Web <> Nil) Then
           SaveAllPics(PathToImages, Web.Document);
                 End Else
            SaveAllPics(PathToImages, E.OleObject.Document);
         Finally
            Screen.Cursor := crDefault;
         End;
      End Else
        MessageDlg('So wie''s ausschaut, enthält diese Seite keine Bilder!', mtInformation, [mbOK], 0);
   Except
     On E: Exception Do
        ShowMessage('Exception - TMainForm.GetAllBrowserPicsActionExecute: ' + E.Message);
   End;
end;


Falls Du damit Probleme hast, ich bin für Fragen offen. :D
focus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 187

XP, 2k, 98, Me
D6 Prof
BeitragVerfasst: Di 15.04.03 09:31 
JEDI hat überignes auch einen netten parser in ihrem soriment ;-)
gruss
michael