WebClient展示未注册(DAAST / VAST)

cooper1210

新成员
已加入
2016年12月4日
留言内容
1
编程经验
1-3
所以我在某些DAAST(或类似的VAST)软件上遇到了问题。这是一个将音频广告插入实时音频流的程序。问题不在于广告注入,而是印象没有在广告代理商处注册。

这是我的代码:

if(ad.AdData.Doc!=null)
            {

                XmlDocument doc =newXmlDocument();

                doc.LoadXml(ad.AdData.Doc.ToString());

                try
                {

                    XmlNodeList mp3 = doc.GetElementsByTagName("MediaFile");
                    String urlMp3 = mp3[0].InnerText.Replace("![CDATA[","").Replace("]]","".Replace("<","").Replace(">",""));

                    XmlNodeList events = doc.GetElementsByTagName("Tracking");

                    XmlNodeList impression = doc.GetElementsByTagName("Impression");
                    String urlImpression = impression[0].InnerText.Replace("![CDATA[","").Replace("]]","".Replace("<","").Replace(">",""));

                    string urlStart ="";
                    string urlComplete ="";

                    for(int i =0; i <3; i++)
                    {
                        switch(events[i].Attributes[0].InnerText)
                        {
                            case"start":
                                urlStart = events[i].InnerXml.Replace("![CDATA[","").Replace("]]","").Replace("<","").Replace(">","");
                                break;
                            case"complete":
                                urlComplete = events[i].InnerXml.Replace("![CDATA[","").Replace("]]","").Replace("<","").Replace(">","");
                                break;
                        }
                    }

                    WebClient clientM =newWebClient();

                    // Download MP3
                    //LogMessage("Downloading MP3: IP- " + data.IP.ToString() + " Country- " + data.country);

                    try
                    {
                        clientM.DownloadDataAsync(newUri(urlMp3));
                    }
                    catch(Exception e)
                    {
                    }

                    WebClient clientI =newWebClient();
                    WebClient clientS =newWebClient();
                    WebClient clientC =newWebClient();

                    // Test whether client is still 'connected'
                    if((DateTime.Now- startConn).TotalSeconds<(int)listener.Duration)
                    {
                        // Fire start / impression NOW. Wait 30 / fire complete

                        LogMessage("Firing Impressions: IP- "+ data.IP.ToString()+" Country- "+ data.country);
                        // LogMessage(ad.AdData.Doc.ToString());
                        // LogMessage("Start URL: - " + urlStart);
                        // LogMessage("Impression URL : - " + urlImpression);
                        clientS.DownloadStringAsync(newUri(urlStart));
                        clientI.DownloadStringAsync(newUri(urlImpression));


                        clientI.DownloadStringCompleted+=(s, err)=>
                        {
                            if(err.Error!=null)
                                LogMessage("Error sending event");
                        };

                        Thread.Sleep(30000);


                        //LogMessage("Firing Complete: IP- " + data.IP.ToString() + " Country- " + data.country);
                        clientC.DownloadStringAsync(newUri(urlComplete));
                }
                catch(Exception e)
                {


                }
            }
        }
这是一个DAAST XML格式 请求示例,为了保护代理机构的身份,我用其他方式替换了URL:
HTML:
<?xml version='1.0' encoding='utf-8'?>
<DAAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
  <Ad id="1:0">
    <Wrapper>
      <AdSystem version="2.0">SomeAdAgency</AdSystem>
      <AdTitle>SomeAdAgency</AdTitle>
      <VASTAdTagURI><![CDATA[//www.SomeAdAgency.com/web/999.xml?daast=1&ip=95.108.142.138&user_id=250841716ef6cad8a537f3a082efed2b]=]=></VASTAdTagURI>
      <Impression><![CDATA[http://www.SomeAdAgency.com/stat/impression.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=385530794]=]=></Impression>
      <Error><![CDATA[http://www.SomeAdAgencycom/stat/error.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=538342366]=]=></Error>
      <Creatives>
        <Creative>
          <Linear>
            <TrackingEvents>
              <Trackingevent="creativeView"><![CDATA[http://www.SomeAdAgency.com/stat/creativeView.gif?v=bj0xJng9MWYyOUY5RTFDQUFERjhkZCZzPTEwMDEmaz0yNTA4NDE3MTZlZjZjYWQ4YTUzN2YzYTA4MmVmZWQyYg%3D%3D&r=747800021]=]=></Tracking>
              <Trackingevent="start"><![CDATA[http://www.SomeAdAgency.com/stat/start.gif?v=bj0xJng9NUZFM0I2M2YyZDhjYzk4NCZzPTEwMDEmaz0yNTA4NDE3MTZlZjZjYWQ4YTUzN2YzYTA4MmVmZWQyYg%3D%3D&r=765191338]=]=></Tracking>
              <Trackingevent="complete"><![CDATA[http://www.SomeAdAgency.com/stat/complete.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=655109920]=]=></Tracking>
              <Trackingevent="pause"><![CDATA[http://www.SomeAdAgency.com/stat/pause.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=109389167]=]=></Tracking>
              <Trackingevent="resume"><![CDATA[http://www.SomeAdAgency.com/stat/resume.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=191427080]=]=></Tracking>
              <Trackingevent="rewind"><![CDATA[http://www.SomeAdAgency.com/stat/rewind.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=260515587]=]=></Tracking>
              <Trackingevent="firstQuartile"><![CDATA[http://www.SomeAdAgency.com/stat/firstQuartile.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=254469603]=]=></Tracking>
              <Trackingevent="midpoint"><![CDATA[http://www.SomeAdAgency.com/stat/midpoint.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=241892418]=]=></Tracking>
              <Trackingevent="thirdQuartile"><![CDATA[http://www.SomeAdAgency.com/stat/thirdQuartile.gif?v=bj0xJnM9MTAwMSZrPTI1MDg0MTcxNmVmNmNhZDhhNTM3ZjNhMDgyZWZlZDJi&r=956375908]=]=></Tracking>
            </TrackingEvents>
            <AudioInteractions>
              <ClickTracking><![CDATA[http://www.SomeAdAgency.com/stat/click.gif?v=bj0xJng9NUMwMGJlZEYzRDNCRWEzMCZzPTEwMDEmaz0yNTA4NDE3MTZlZjZjYWQ4YTUzN2YzYTA4MmVmZWQyYg%3D%3D&r=134882117]=]=></ClickTracking>
            </AudioInteractions>
          </Linear>
        </Creative>
      </Creatives>
      <Extensions>
        <Extension type="isClickable"><![CDATA[0]=]=></Extension>
      </Extensions>
    </Wrapper>
  </Ad>
</DAAST>

我怀疑下载或调用跟踪像素的方式有问题吗?

任何人都可以对此发表看法吗?

谢谢
 
由主持人最后编辑:
最佳 底部