<?xml version="1.0" encoding="utf-8"?>
<HmsMediaItem>
  <MediaType>3</MediaType>
  <ClassID>53</ClassID>
  <ItemID>3cae0728-027a-4de4-9a49-4d684a026fb0</ItemID>
  <ItemPath></ItemPath>
  <ParentID>234DF17B-418C-4FDC-9DFE-CD0C586D2E76</ParentID>
  <Properties>
    <Property>
      <ID>4</ID>
      <Value>0001.webtv.md</Value>
    </Property>
    <Property>
      <ID>515</ID>
      <Value>1</Value>
    </Property>
    <Property>
      <ID>700</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>701</ID>
      <Value>-1</Value>
    </Property>
    <Property>
      <ID>702</ID>
      <Value>-1</Value>
    </Property>
    <Property>
      <ID>517</ID>
      <Value>578-720,722-1080,482-576,402-480,322-400,202-320,0-200</Value>
    </Property>
    <Property>
      <ID>518</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>512</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>530</ID>
      <Value>const
  PCRE_CASELESS   = $00000001;
  PCRE_DOTALL     = $00000004;
  PCRE_SINGLELINE = PCRE_CASELESS + PCRE_DOTALL;
  INTERNET_FLAG_NO_AUTO_REDIRECT = $00200000;

var
  s,s1,reg,ini, file,kat,id,id1,pap,foto,foto1,anul,mes,god,pl,vol,seed,VerGen: string;
  gsHeaders, gsRec,sAnswHeaders,sRedirectLink: string;
  j,ind,i,aPercent,e,grp:Integer;
  ItemsRegExpr,ItemsRegExpr1,ItemsRegExpr2: TRegExpr;
  sWebPage,sWebPage1,sWebPage2,total,total1,sJsonResponse: string;
  Item: THmsScriptMediaItem;
  myYear, myMonth, myDay,  : Word;


    sItemLink: string;

   procedure film(const aItemDescr: string);   // выделение свойств фильмов в строке
  var
    Item: THmsScriptMediaItem;   // строчка в перечне фильмов
    sItemLink,s: string;
    sItemAdr,sItemDenum,sItemImg,v,sItemID: string;
 begin // начало процедуры

 i := i + 1 ;
        if i &gt; 200 then begin
         grp := grp + 1 ;
         i := 1 ;
        end;

  sItemAdr := &apos;&apos;;
//ShowMessage(aItemDescr) ;
HmsRegExMatch3(&apos;id":(.*?),.*?thumbnail":"(.*?)".*?"name":"(.*?)"&apos;, aItemDescr, sItemID, sItemImg, sItemDenum ); // в строку sItemLink вставить то что между (href=") и (") из aItemDescr


    sItemLink := &apos;http://webtv.md/view_channel.jsp?id=&apos; + sItemID ;

   Item := HmsCreateMediaItem(sItemLink, FolderItem.ItemID,  pap ); //создать пункт со ссылкой на фильм

    Item.Properties[mpiTitle] := Format(&apos;%.2d&apos;, [i]) + &apos;. &apos; + sItemDenum ;   //название
    Item.Properties[mpiThumbnail] := &apos;&apos; +sItemImg ; //картинка
//  Item.Properties[mpiComment] := sItemLink ; //Содержание
 // Item.Properties[mpiTimeLength] := &apos;01:40:00.000&apos; ; //продолжительность
end; // конец процедуры

// -----------------------------------------------------------------------------------------------------

   procedure regiune(const aItemDescr: string);   // выделение свойств фильмов в строке
  var
    Item: THmsScriptMediaItem;   // строчка в перечне фильмов
    sItemLink,s: string;
    sItemAdr,sItemDenum,sItemImg,v: string;
 begin // начало процедуры


  //        ShowMessage(aItemDescr) ;
          
            HmsRegExMatch(&apos;type-post_type.*?&lt;span&gt;(.*?)&lt;/span&gt;&apos;, aItemDescr, reg);
            
            aItemDescr := &apos;333&apos; +  aItemDescr + &apos;444333&apos;;
            HmsRegExMatch(&apos;333(.*?)333&apos;, aItemDescr, s);
            
    ItemsRegExpr1 := TRegExpr.Create(&apos;&lt;li id="menu-item-(.*?)&lt;/a&gt;&lt;/li&gt;&apos;,PCRE_SINGLELINE);  //создать объект
    try
      if ItemsRegExpr1.Search(s) then repeat    //искать в исх.строке объект и повторять
     film(ItemsRegExpr1.Match)   //запускать процедуру получения свойств фильма каждый раз как найден объект
      until not ItemsRegExpr1.SearchAgain;
    finally
      ItemsRegExpr1.Free    //освободить объект   
     end;       
         

end; // конец процедуры


// -----------------------------------------------------------------------------------------------------



begin
    grp :=  1;
    FolderItem.DeleteChildItems;

  gsHeaders := &apos;Accept: application/json, text/javascript, */*; q=0.01&apos;#10#13;
  gsHeaders := gsHeaders+&apos;X-Requested-With: XMLHttpRequest&apos;#10#13;
  gsHeaders := gsHeaders+&apos;User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36&apos;#10#13;  
  gsHeaders := gsHeaders+&apos;Referer: http://webtv.md/view_channel.jsp?id=185&apos;#10#13;

  
    sJsonResponse := HmsSendRequest(&apos;webtv.md&apos;, &apos;/service/video/channels&apos;, &apos;GET&apos;, &apos;application/x-www-form-urlencoded&apos;,gsHeaders,&apos;&apos;,80);

    sJsonResponse := HmsUtf8Decode(sJsonResponse);
    total := HmsJsonDecode(sJsonResponse);



    ItemsRegExpr := TRegExpr.Create(&apos;{(.*?)}&apos;,PCRE_SINGLELINE);  //создать объект
    try
      if ItemsRegExpr.Search(total) then repeat    //искать в исх.строке объект и повторять
     film(ItemsRegExpr.Match)   //запускать процедуру получения свойств фильма каждый раз как найден объект
      until not ItemsRegExpr.SearchAgain;
    finally
      ItemsRegExpr.Free    //освободить объект
    end  ;

HmsHideInformation;
end .</Value>
    </Property>
    <Property>
      <ID>531</ID>
      <Value>PascalScript</Value>
    </Property>
    <Property>
      <ID>532</ID>
      <Value>1</Value>
    </Property>
    <Property>
      <ID>553</ID>
      <Value>1</Value>
    </Property>
    <Property>
      <ID>522</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>245</ID>
      <Value>3cae0728-027a-4de4-9a49-4d684a026fb0</Value>
    </Property>
    <Property>
      <ID>93</ID>
      <Value>42374,8914128704</Value>
    </Property>
    <Property>
      <ID>550</ID>
      <Value>Var
  gsUrlBase: String = "http://webtv.md";

// --- Формирование ссылки канала с сайта webtv.md ----------------------------
Procedure GetLink_WebTv();
Var
  sLink, sID, sXml, sServ, sApp, sFlashVer, sFlashUrl, sPlaypath: String;
Begin
  HmsRegExMatch(&apos;id=(\d+)&apos;, mpFilePath, sID);
  sXml := HmsDownloadURL(gsUrlBase+&apos;/service/streams/&apos;+sID, &apos;Referer: &apos;+mpFilePath, True);
  HmsRegExMatch(&apos;&lt;name&gt;(.*?)&lt;/name&gt;&apos;              , sXml, sPlaypath);
  HmsRegExMatch(&apos;&lt;rtmp_server&gt;(.*?)&lt;/rtmp_server&gt;&apos;, sXml, sServ    );
  sApp      := &apos;live&apos;;
  sFlashVer := &apos;WIN 18,0,0,232&apos;;
  sFlashUrl := &apos;http://webtv.md/swf/WebTV.swf&apos;;
  
//  sLink := Format(&apos;rtmpdump.exe "%s" --app "%s" --flashVer "%s" -W "%s" --pageUrl "%s" --playpath "%s"&apos;,
  sLink := Format(&apos;-r "%s" --app "%s" --flashVer "%s" -W "%s" --pageUrl "%s" --playpath "%s"&apos;,
                    [sServ, sApp, sFlashVer, sFlashUrl, mpFilePath, sPlaypath]);
  
  MediaResourceLink := sLink;
End;
  
  
///////////////////////////////////////////////////////////////////////////////
//                     Г Л А В Н А Я   П Р О Ц Е Д У Р А                     //
Begin
  
  GetLink_WebTv();

End.</Value>
    </Property>
    <Property>
      <ID>551</ID>
      <Value>PascalScript</Value>
    </Property>
    <Property>
      <ID>525</ID>
      <Value>42374,8918289931</Value>
    </Property>
  </Properties>
</HmsMediaItem>
