Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
html parse repeat
#1
arkadarlar html parse işlemi yapıyorum. sitenin kaynak kodunu aldım aşağıdaki kodla veriyi aradan çektim fakat kaynak kodu bitene kadar tüm verileri çekemedim. sadece ilk gördüğü veriyi alıyor. repeat işlemi nasıl yapabilirim.

Function aradansec( text, ilk, son:String ): String;
begin
 Delete(Text, 1, pos(ilk, Text) + Length(ilk)-1);
 Result := Copy(Text, 1, Pos(Son, Text)-1);
end;
Cevapla
#2
Pos(aranan, kaynak) komutunu kullan.

repeat
p := pos(ilk, Text);
Delete(Text, 1, p + Length(ilk)-1);
Result := Copy(Text, 1, Pos(Son, Text)-1);
until (p = 0);

şeklinde yapabilirsiniz.
Cevapla
#3
Delphi version?

Kendi fonksiyonunuzu oluşturmanıza ve bazı mantıksal hatalar yapmanıza gerek kalmadan her şeyi basitleştirir!

 newStr := StringReplace('source', 'old pattern', 'new pattern', [ rfReplaceAll, rfIgnoreCase]);  -> tüm olaylar

 newStr2 := newStr.Replace('old pattern', 'new patter', [rfReplaceAll, rfIgnoreCase]);

 old pattern = güncel metin
 new pattern = yeni bir metin veya boş bir değer
 flags = [] (1 occurrence)  or [ rfXXXXXXXXXX ]   Burada dilediğiniz gibi bir veya iki bayrağı birleştirebilirsiniz.
 
 Daha fazla bilgi için F1 tuşuna basın.

  xxx := StringReplace('hello world',  'hello', 'HELLO', [] );  -> ilk oluşum
  xxx := StringReplace(xxx,  'HELLO', '', [] );

--------------

// var xxxStr : string := 'Hello';

 Delete( xxxStr, 3, 2 );  //  LL
 ShowMessage (  xxxStr );   //  Heo

"Delete(...)" kullanmak orijinal metni değiştirir, bu yüzden bir sabit değil bir değişken kullanmalısınız, bu yüzden "döngü" kullanmak karakter sayısı azalacağından mantık hatasına neden olabilir!  Başarılı bir silme işleminden sonra metin zaten yeni değere değiştirildiği için Copy(...)'e ihtiyacınız yok
Bizi izlemeye devam edin!

Function aradansec(       VAR text,            ilk, son:String ): String;  // use "VAR xxxxxxx"

değişkenin orijinal içeriğini değiştirmenize olanak tanır, çünkü onu fonksiyonunuza bir "referans" olarak aktarırsınız. Bu şekilde, kaynak değişkeninizle iyi ya da kötü, istediğiniz her şeyi yapabilirsiniz.
MSWindows, AndroidRAD Studio 13 Florence ve kafamda bir fikir  Tongue  
WWW
Cevapla
#4
(28-10-2025, Saat: 18:42)enigma Adlı Kullanıcıdan Alıntı: Pos(aranan, kaynak) komutunu kullan.

repeat
p := pos(ilk, Text);
Delete(Text, 1, p + Length(ilk)-1);
Result := Copy(Text, 1, Pos(Son, Text)-1);
until (p = 0);

şeklinde yapabilirsiniz.

çalıştıramadım bu kodu. 

<TD><A title="2N3053 Bipolar Transistor specs" href="/bipolar-transistors/2n3053">2N3053</A></TD>
<TD>NPN</TD>
<TD>80 V</TD>
<TD>50 - 250</TD>
<TD>0.7 A</TD>
<TD>TO-39</TD></TR></TBODY></TABLE></DIV><NAV class="pagination group">

cxMemo2.Lines.Add(aradansec(cxMemo1.Text,'/bipolar-transistors/','">'));

almak istediğim kırımızı yazı olanı ama çıktısı aşağıdaki gibi oluyor. önce başlıkları alıcam sonra TD aralarındaki özellikleri alıcam. bu arada bu verdiği çıktı sayfanın en sonundaki kaynak kodu. en baştakileri es geçiyor. en sonrakini alıyor.

TD>
<TD>NPN</TD>
<TD>80 V</TD>
<TD>50 - 250</TD>
<TD>0.7 A</TD>
<TD>TO-39</TD></TR></TBODY></TABLE></DIV><NAV class="pagination group
Cevapla
#5
İstediğinizi yanlış anlamadıysam href="/bipolar-transistors/ ifadesinden sonra gelen ürün kodunu almak istiyorsunuz. 
Bunun için Regex kullanılabilir.
Aşağıdaki yaklaşımı kendinize uyarlayabilirsiniz.

Yapay zekanın önerdiği çözüm:

uses System.RegularExpressions;

var
 HTML: string;
 Matches: TMatchCollection;
 M: TMatch;
begin
 HTML := Memo1.Text; // Gelen HTML burada olsun

 Matches := TRegEx.Matches(HTML,
   'href="\/bipolar-transistors\/([^">]+)"',
   [roIgnoreCase]);

 if Matches.Count > 0 then
 begin
   for M in Matches do
     ShowMessage(M.Groups[1].Value); // Örn: 2n3053, 2n2222, bc547 ...
 end
 else
   ShowMessage('Hiç veri bulunamadı!');
end;
Cevapla
#6
Kendi fonksiyonunu revize etmek istersen aşağıdaki şekilde denemek isteyebilirsin.

tumu isimli parametreyi girmezsen senin eski fonksiyon gibi olur, TRUE girersen repeat döngüsü aranan "ilk" parametresi bitene kadar çalışır.


Function aradansec( text, ilk, son:String; tumu:boolean = false ): String;
begin
  result := '';
  repeat
    if pos(ilk, Text) > 0 then
    begin
      System.Delete(Text, 1, pos(ilk, Text) + Length(ilk)-1);
      Result := Result + Copy(Text, 1, Pos(Son, Text)-1) + sLineBreak;
    end;
  until (not tumu) or ( pos(ilk, Text) = 0 );
end;



Kullanımı :


uses
 System.Net.HttpClientComponent;

procedure TForm1.BitBtn1Click(Sender: TObject);
var
 LResponse   : string;
 LIlk, LSon  : string;
 LResult     : string;
begin
 With TNetHTTPClient.Create(nil) do
 try
   LResponse := Get( 'https://www.delphican.com/showthread.php?tid=8202' ).ContentAsString;
 finally
   free;
 end;

 // Tüm href'ler isteniyor..
 LIlk := 'href="';
 LSon := '"';

 LResult := aradansec( LResponse, LIlk, LSon, true );  // veya FALSE olursa senin eski fonksiyonun gibi olur sadece ilkini bulur.

 showmessage( LResult );

end;
Saygılarımla
Muharrem ARMAN

guplouajuixjzfm15eqb.gif
Cevapla
#7
Alttaki konuda örneklerini verdiğim jquey selektörler ile html sayfada dom üstünde istediğin gibi gezinip veri toplayabilirsin .
basit bir js kod ile istediğin datayı toplayıp bir değişkene atıp encodeURI  metodu ile browserdan alabilirsin.

https://www.delphican.com/showthread.php?tid=7501
Eski tuğlalarla yeni bina yapılmaz.
Cevapla
#8
Ürün kodundan sonra TD tagleri arasındaki ürün özellikleri istediğinizi gözden kaçırmışım.

Örnek Çıktı

   

Kodlar:

unit Unit1;

interface

uses
 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
 Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,System.RegularExpressions, System.JSON;

type
 TForm1 = class(TForm)
   Button1: TButton;
   Memo1: TMemo;
   Memo2: TMemo;
   procedure Button1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
 Form1: TForm1;

implementation

{$R *.dfm}

function CleanHTMLTags(const S: string): string;
begin
 // Tüm HTML taglerini kaldır
 Result := TRegEx.Replace(S, '<[^>]+>', '', [roIgnoreCase]);
 // Fazla boşluk, satır sonlarını temizle
 Result := TRegEx.Replace(Result, '\s+', ' ', [roIgnoreCase]).Trim;
end;


procedure TForm1.Button1Click(Sender: TObject);
var
 TRMatches, TDMatches: TMatchCollection;
 M, TDMatch: TMatch;
 RowArray, TDArray: TJSONArray;
 RowObj: TJSONObject;
 CleanValue: string;
 HTML:string;
begin
 HTML := memo1.Text; // Html memo1 içerisinde

 TRMatches := TRegEx.Matches(HTML,
   '<TR[^>]*?>(.*?)<\/TR>', [roIgnoreCase, roSingleLine]);

 RowArray := TJSONArray.Create;

 for M in TRMatches do
 begin
   var CodeMatch := TRegEx.Match(M.Value,
     'href="\/bipolar-transistors\/([^">]+)"',
     [roIgnoreCase]);

   if not CodeMatch.Success then
     Continue;

   RowObj := TJSONObject.Create;
   RowObj.AddPair('urun_kodu', CodeMatch.Groups[1].Value);

   TDMatches := TRegEx.Matches(M.Value,
     '<TD[^>]*?>(.*?)<\/TD>', [roIgnoreCase, roSingleLine]);

   TDArray := TJSONArray.Create;

   for TDMatch in TDMatches do
   begin
     CleanValue := CleanHTMLTags(TDMatch.Groups[1].Value);
     if CleanValue <> '' then
       TDArray.Add(CleanValue);
   end;

   RowObj.AddPair('veriler', TDArray);
   RowArray.Add(RowObj);
 end;

 // Sonucu JSON olarak memo2 ye aktar
 memo2.Lines.Clear;
 memo2.Lines.Add(RowArray.Format(2));
end;

end.
Cevapla
#9
Merhaba,

Nokta atışı işlem yapalım o halde. Sanırım istediğiniz böyle bir şey;
Konuya yorum yapmış kullanıcıların benzersiz ID bilgisini çekelim.

   

function SourceGetParse(WebLink: string; MainTag: string; FirstTag: string; LastTag: string; FromTarget: TMemo): boolean;
var
 aClient: System.Net.HttpClientComponent.TNetHTTPClient;
 LinkSource: TStringList;
 MainTagPosCount: integer;
 FirstTagPosCount: integer;
 LastTagPosCount: integer;
 FirstTagLen: integer;
 MainTagLen: integer;
 LastTagLen: integer;
 DesiredArea: string;
begin
 try
   try
     LinkSource := TStringList.Create;
     aClient := TNetHTTPClient.Create(nil);
     try

       LinkSource.Text := aClient.Get(WebLink).ContentAsString();
       MainTagLen := Length(MainTag);
       FirstTagLen := Length(FirstTag);
       LastTagLen := Length(LastTag);

       while Pos(MainTag, LinkSource.Text) > 0 do
       begin
         LinkSource.Text := Copy(LinkSource.Text, Pos(MainTag, LinkSource.Text) + MainTagLen, LinkSource.Text.Length);
         LinkSource.Text := Copy(LinkSource.Text, Pos(FirstTag, LinkSource.Text) + FirstTagLen, LinkSource.Text.Length);
         LastTagPosCount := Pos(LastTag, LinkSource.Text);
         DesiredArea := Copy(LinkSource.Text, 0, LastTagPosCount - LastTagLen);
         FromTarget.Lines.Add((DesiredArea));
       end;
     finally
       Result := true;
     end;
   except
     Result := false;
   end;
 finally
   FreeAndNil(aClient);
   FreeAndNil(LinkSource);
 end;
end;

Kullanımı :

  SourceGetParse('https://www.delphican.com/showthread.php?tid=8202&pid=57990#pid57990','post_content','class="post_body scaleimages" id="', '">', Memo1 );

Serhat YANALAK - FMX Software Developer
Cevapla
#10
teşekkürler arkadaşlar. bilgileri çekerek veritabanına kaydettim. şimdi içerik sayfasındaki bilgileri çekicem. birazda onunla uğraşayım. ön bilgileri çeken ve veritabanına kaydeden kodu paylaşıyorum ihtiyacı olan arkadaşlar olaiblir. 3 buton kullandım 1. sayfaya gidiyor. 2. memdata ya çekiyor. 3. veritabanına kaydediyor.


unit Unit2;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
 Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.OleCtrls, SHDocVw, Vcl.StdCtrls,
 cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer,
 cxEdit, dxSkinsCore, dxSkinBasic, dxSkinBlack, dxSkinBlue, dxSkinBlueprint,
 dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom, dxSkinDarkSide,
 dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
 dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
 dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
 dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
 dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
 dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
 dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
 dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark,
 dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray,
 dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
 dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust,
 dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine,
 dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark,
 dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint, dxSkinWXI,
 dxSkinXmas2008Blue, cxTextEdit, cxMemo, Xml.xmldom, Xml.XMLIntf, Xml.XMLDoc,MSHTML,
 System.RegularExpressions, cxStyles, cxCustomData, cxFilter, cxData,
 cxDataStorage, cxNavigator, dxDateRanges, dxScrollbarAnnotations, Data.DB,
 cxDBData, dxmdaset, cxGridLevel, cxClasses, cxGridCustomView,
 cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,System.Generics.Collections,
 MemDS, DBAccess, Uni, UniProvider, MySQLUniProvider, Vcl.Menus, System.Win.Registry;

type
 TForm2 = class(TForm)
   WebBrowser1: TWebBrowser;
   Edit1: TEdit;
   Button1: TButton;
   XMLDocument1: TXMLDocument;
   Button3: TButton;
   Memo1: TMemo;
   Memo2: TMemo;
   cxGrid1DBTableView1: TcxGridDBTableView;
   cxGrid1Level1: TcxGridLevel;
   cxGrid1: TcxGrid;
   DataSource1: TDataSource;
   dxMemData1: TdxMemData;
   dxMemData1URUN_ADI: TStringField;
   dxMemData1TIPI: TStringField;
   dxMemData1VOLTAJ: TStringField;
   dxMemData1HFE: TStringField;
   dxMemData1AKIM: TStringField;
   dxMemData1KILIF: TStringField;
   cxGrid1DBTableView1RecId: TcxGridDBColumn;
   cxGrid1DBTableView1URUN_ADI: TcxGridDBColumn;
   cxGrid1DBTableView1TIPI: TcxGridDBColumn;
   cxGrid1DBTableView1VOLTAJ: TcxGridDBColumn;
   cxGrid1DBTableView1HFE: TcxGridDBColumn;
   cxGrid1DBTableView1AKIM: TcxGridDBColumn;
   cxGrid1DBTableView1KILIF: TcxGridDBColumn;
   Button4: TButton;
   UniConnection1: TUniConnection;
   transistor: TUniQuery;
   MySQLUniProvider1: TMySQLUniProvider;
   MainMenu1: TMainMenu;
   ransistorDetay1: TMenuItem;
   Mosfet1: TMenuItem;
   MosfetDetay1: TMenuItem;
   Diyot1: TMenuItem;
   DiyotDetay1: TMenuItem;
   ZenerDiyot1: TMenuItem;
   ZenerDiyotDetay1: TMenuItem;
   KprDiyot1: TMenuItem;
   KprDiyotDetay1: TMenuItem;
   procedure Button1Click(Sender: TObject);

   procedure Button2Click(Sender: TObject);
   procedure Button3Click(Sender: TObject);
   procedure Button4Click(Sender: TObject);
   procedure ransistorDetay1Click(Sender: TObject);
   procedure FormCreate(Sender: TObject);
   procedure WebBrowser1DocumentComplete(ASender: TObject;
     const pDisp: IDispatch; const URL: OleVariant);

 private
   procedure ExtractTDsAndSave(const SourceText: string);
    procedure SetIEFeatureBrowserEmulation;
   procedure InjectSuppressScript;
   { Private declarations }
 public
   { Public declarations }
 end;

var
 Form2: TForm2;

implementation
            uses Unit1, Winapi.ActiveX;
{$R *.dfm}


procedure TForm2.SetIEFeatureBrowserEmulation;
var
 Reg: TRegistry;
 AppName: string;
begin
 AppName := ExtractFileName(ParamStr(0));
 Reg := TRegistry.Create(KEY_WRITE);
 try
   Reg.RootKey := HKEY_CURRENT_USER;
   if Reg.OpenKey('\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION', True) then
   begin
     // IE11 modu (11001) — uygulamanızın adını anahtar olarak yaz
     Reg.WriteInteger(AppName, 11001);
     Reg.CloseKey;
   end;
 finally
   Reg.Free;
 end;
end;

procedure TForm2.WebBrowser1DocumentComplete(ASender: TObject;
 const pDisp: IDispatch; const URL: OleVariant);
var
 Doc: IHTMLDocument2;
begin
      Memo1.Text:=WebBrowser1.OleObject.Document.Body.InnerHTML;
 // pDisp kontrolü: bize gelen event bizim webbrowser'a aitse çalıştır
 if Assigned(pDisp) and Assigned(WebBrowser1.ControlInterface) then
 begin
   // bazen birden fazla DocumentComplete gelir (frame'ler için).
   // Bu kontrol ensures we inject only for top-level document:
   if pDisp = IWebBrowser2(WebBrowser1.ControlInterface) then
   begin
     try
       Doc := WebBrowser1.Document as IHTMLDocument2;
       if Assigned(Doc) then
         InjectSuppressScript; // JS'i enjekte et
     except
       // boş bırak — hata olsa da uygulama çökmemeli
     end;
   end;
 end;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
 // Sessiz modu aç
 WebBrowser1.Silent := True;

 // IE emülasyon ayarı (kullanıcı hesabı seviyesinde)
 try
   SetIEFeatureBrowserEmulation;
 except
   // Registry'e yazılamazsa uygulama yine çalışır; hatayı gizle
 end;
end;

procedure TForm2.InjectSuppressScript;
var
 Doc2: IHTMLDocument2;
 Win: IHTMLWindow2;
 Script: WideString;
begin
 // Güvenli bir JS snippet: hataları yutar ve alert/confirm/prompt/console fonksiyonlarını devre dışı bırakır.
 Script :=
   'try {' +
   '  window.onerror = function(msg, url, line, col, error) { return true; };' +
   '  window.alert = function() { return null; };' +
   '  window.confirm = function() { return false; };' +
   '  window.prompt = function() { return null; };' +
   '  if (typeof console !== "undefined") {' +
   '    if (!console.error) console.error = function(){};' +
   '    console.error = function(){}; console.warn = function(){}; console.log = function(){}; ' +
   '  }' +
   '} catch(e) { /* ignore */ }';

 try
   Doc2 := WebBrowser1.Document as IHTMLDocument2;
   if Assigned(Doc2) then
   begin
     Win := Doc2.parentWindow;
     if Assigned(Win) then
     begin
       // execScript ile JavaScript çalıştır
       Win.execScript(Script, 'JavaScript');
     end;
   end;
 except
   // eğer Document veya parentWindow alınamazsa sessizce geç
 end;
end;
//
procedure TForm2.ExtractTDsAndSave(const SourceText: string);
var
 CellMatches: TMatchCollection;
 CellMatch: TMatch;
 Cells: TStringList;
 i, recCount, savedCount: Integer;
 v: string;
begin
 Cells := TStringList.Create;
 try
   // Tüm <TD> içeriğini yakala
   CellMatches := TRegEx.Matches(SourceText, '<TD\b[^>]*>(.*?)</TD>', [roSingleLine, roIgnoreCase]);

   for CellMatch in CellMatches do
   begin
     v := CellMatch.Groups[1].Value;
     // İçerideki diğer HTML etiketlerini temizle
     v := TRegEx.Replace(v, '<[^>]+>', '', [roSingleLine]);
     v := Trim(v);
     Cells.Add(v);
   end;

   if Cells.Count = 0 then
   begin
     ShowMessage('Hiç <TD> bulunamadı.');
     Exit;
   end;

//    if not FDConnection1.Connected then
//      FDConnection1.Connected := True;
//
//    FDQuery1.SQL.Text :=
//      'INSERT INTO td_veriler (alan1, alan2, alan3, alan4, alan5, alan6) ' +
//      'VALUES (:a1, :a2, :a3, :a4, :a5, :a6)';
//    FDQuery1.Prepared := True;
//
//    FDConnection1.StartTransaction;


   try
     savedCount := 0;
     recCount := 0;
     i := 0;
     while i < Cells.Count do
     begin
       // Her bir parametre için index kontrolü yapıyoruz
       dxMemData1.Append;
       if i < Cells.Count then
         dxMemData1.FieldByName('URUN_ADI').AsString := Cells[i]
       else
         dxMemData1.FieldByName('URUN_ADI').AsString := '';

       if (i+1) < Cells.Count then
         dxMemData1.FieldByName('TIPI').AsString := Cells[i+1]
       else
         dxMemData1.FieldByName('TIPI').AsString := '';

       if (i+2) < Cells.Count then
         dxMemData1.FieldByName('VOLTAJ').AsString := Cells[i+2]
       else
         dxMemData1.FieldByName('VOLTAJ').AsString := '';

       if (i+3) < Cells.Count then
         dxMemData1.FieldByName('HFE').AsString := Cells[i+3]
       else
         dxMemData1.FieldByName('HFE').AsString := '';

       if (i+4) < Cells.Count then
         dxMemData1.FieldByName('AKIM').AsString := Cells[i+4]
       else
         dxMemData1.FieldByName('AKIM').AsString := '';

       if (i+5) < Cells.Count then
         dxMemData1.FieldByName('KILIF').AsString := Cells[i+5]
       else
         dxMemData1.FieldByName('KILIF').AsString := '';

         dxMemData1.Post;

            Application.ProcessMessages;
     // FDQuery1.ExecSQL;
       Inc(savedCount);
       Inc(recCount);

       // Memo'ya ekle (kontrol amaçlı)
       memo2.Lines.Add(Format('Kayıt %d: %s | %s | %s | %s | %s | %s',
         [recCount,
           dxMemData1.FieldByName('URUN_ADI').AsString,
           dxMemData1.FieldByName('TIPI').AsString,
           dxMemData1.FieldByName('VOLTAJ').AsString,
           dxMemData1.FieldByName('HFE').AsString,
           dxMemData1.FieldByName('AKIM').AsString,
           dxMemData1.FieldByName('KILIF').AsString]));

       Inc(i, 6);
     end;

  //   FDConnection1.Commit;
  //   ShowMessage(Format('%d TD bulundu, %d kayıt veritabanına eklendi.', [Cells.Count, savedCount]));
   except
     on E: Exception do
     begin
    //   FDConnection1.Rollback;
       raise;
     end;
   end;
 finally
   Cells.Free;
     WebBrowser1.Navigate(edit1.text);
 end;
end;



procedure TForm2.ransistorDetay1Click(Sender: TObject);
begin
Form1.Show;
end;

Function aradansec(text, ilk, son:String ): String;
begin
 Delete(Text, 1, pos(ilk, Text) + Length(ilk)-1);
 Result := Copy(Text, 1, Pos(Son, Text)-1);

end;

procedure TForm2.Button1Click(Sender: TObject);
begin
Memo1.Clear;
WebBrowser1.Navigate(edit1.Text);
dxMemData1.Close;
dxMemData1.Open;

// Örnek: bir URL aç
//  WebBrowser1.Navigate('https://ornek.com');

 // veya MemoHTML içeriğini doğrudan WebBrowser'a yükleyip DocumentComplete sonrasında enjeksiyon gerçekleşir:
 // WebBrowser1.Navigate('about:blank');
 // if Assigned(WebBrowser1.Document) then
 // begin
 //   (WebBrowser1.Document as IHTMLDocument2).write(MemoHTML.Lines.Text);
 // end;
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
form1.show;
end;



procedure TForm2.Button3Click(Sender: TObject);
var
i,s:Integer;
begin
i:=1;
s:=1;
// memo2.Clear;
for i := 1 to 345 do
begin
s:=i+1;

 ExtractTDsAndSave(memo1.Lines.Text);
 Edit1.text:='https://www.el-component.com/bipolar-transistors-page'+inttostr(s);



//ShowMessage('İşlem tamamlandı. Veriler 6 sütun olarak kaydedildi.');
end;
end;



procedure TForm2.Button4Click(Sender: TObject);
begin
dxMemData1.First;
while not dxMemData1.Eof do
begin
transistor.Close;
transistor.SQL.Clear;
transistor.SQL.Add
 ('INSERT INTO transistor (PARCA_ADI,TIPI,CB_VOLT,HFE,CCURRENT,KILIF) values '
 + '(TongueARCA_ADI,:TIPI,:CB_VOLT,:HFE,:CCURRENT,:KILIF)');
transistor.Params.ParamByName('PARCA_ADI').AsString := trim(dxMemData1.FieldByName('URUN_ADI').AsString);
transistor.Params.ParamByName('TIPI').AsString := trim(dxMemData1.FieldByName('TIPI').AsString);
transistor.Params.ParamByName('CB_VOLT').AsString := trim(dxMemData1.FieldByName('VOLTAJ').AsString);
transistor.Params.ParamByName('HFE').AsString := trim(dxMemData1.FieldByName('HFE').AsString);
transistor.Params.ParamByName('CCURRENT').AsString := trim(dxMemData1.FieldByName('AKIM').AsString);
transistor.Params.ParamByName('KILIF').AsString := trim(dxMemData1.FieldByName('KILIF').AsString);
transistor.ExecSQL;

dxMemData1.Next;
Application.ProcessMessages;
end;
end;



end.
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  HTML Editor m_ekici 1 470 19-01-2025, Saat: 11:05
Son Yorum: bydelphi
  Local HTML Dosyasını Yazdırma Hayati 2 1.036 09-01-2023, Saat: 12:33
Son Yorum: Hayati
  Html veya Xml pdf e çevirme ahmet6513 11 4.491 02-01-2023, Saat: 15:22
Son Yorum: ahmet6513
  Fast Report'da HTML Gösterme Hk. pro_imaj 4 1.554 10-10-2022, Saat: 11:24
Son Yorum: pro_imaj
  Json Parse İşlemi bünyamin68 10 4.443 24-07-2022, Saat: 09:49
Son Yorum: arsl01



Konuyu Okuyanlar: 1 Ziyaretçi