Показать сообщение отдельно
  #3  
Старый 17.06.2016, 09:12
ApxaHGe1 ApxaHGe1 вне форума
Активный
 
Регистрация: 08.04.2008
Адрес: Нижний новгород
Сообщения: 311
Репутация: 38
По умолчанию

Там вроде дропбокс, без реклам и все такое

Код:
procedure TForm1.Button1Click(Sender: TObject);
var
i,n,temp,temp2:integer;
begin
temp:=0;

for i:=0 to ListBox1.Items.Count-1 do
begin
Memo1.Text:=IdHTTP1.Get('http://www.galacentre.ru/api/GetCatalog/yml/?key='+Edit1.Text+'&catalog='+ListBox1.Items.Strings[i]+'&store=msk');
Memo1.Lines.Strings[0]:='';
ParseArt(Memo1.Text,'<articul>','</articul>',Memo2.Lines);
temp2:=Memo2.Lines.Count-1;

if ListBox1.Items.Strings[i] = 'dacha' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Дача');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'suvenir' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Сувениры');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'posuda' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Посуда');
end;
temp:=temp+Memo2.Lines.Count;
end;


if ListBox1.Items.Strings[i] = 'hoztovar' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Хозтовары');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'instrument' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Инструменты');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'galante' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Галантерея');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'santehnika' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Сантехника');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'furnitura' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Фурнитура');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'textile' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Домашний текстиль');
end;
temp:=temp+Memo2.Lines.Count;
end;

if ListBox1.Items.Strings[i] = 'technics' then
begin
for n := temp to temp2 do
begin
Memo3.Lines.Add('Бытовая техника');
end;
temp:=temp+Memo2.Lines.Count;
end;

ParseArt(Memo1.Text,'<name>','</name>',Memo4.Lines);
ParsePrice(Memo1.Text,'<price>','</price>',Memo5.Lines);
ParseCount(Memo1.Text,'<param name="MSK">','</param>',Memo6.Lines);
ParseImg(Memo1.Text,'<picture>','</picture>',Memo7.Lines);
end;
Label1.Caption:=IntToStr(Memo2.Lines.Count-1);
Label2.Caption:=IntToStr(Memo3.Lines.Count-1);
Label3.Caption:=IntToStr(Memo4.Lines.Count-1);
Label4.Caption:=IntToStr(Memo5.Lines.Count-1);
Label5.Caption:=IntToStr(Memo6.Lines.Count-1);
Label6.Caption:=IntToStr(Memo7.Lines.Count-1);
end;
Выделенное красным, работает 2 раза только на дача и сувенир и на остальных категориях просто игнорируется
Ответить с цитированием