Objectif将监控大量网站,并在调用特定广告代码时自动获取屏幕截图(之前已定义,属于新广告系列)
答案 0 :(得分:1)
在调用特定广告代码时自动获取屏幕截图
当您说某个特定广告代码被“调用”时,我不确定您的意思。你这么说的是什么意思?
如果我理解正确,您似乎想要捕获广告,如果它在网站上显示。如果这是正确的理解,那么您可以保存广告的HTML并稍后“重播”它。您必须检查HTML中的某些标记,以便检测广告是否正在展示。
让我们看一下Google广告的工作原理。我们假设您搜索关键字“牙医”:http://www.google.com/search?hl=en&q=dentist
首先,您必须检测到广告是否存在,并且在Google上指示的最常见方式是使用<div id="tads">
div。如果你看一下HTML,div标签将如下所示:
<div id="tads" class="c" style="margin:0 0 14px;padding-top:2px;padding-right:36px;padding-bottom:2px;padding-left:8px;min-height:0">
<h2 style="font-size:11px;font-weight:normal;margin:0 -35px 0 0;padding:1px 4px 0 0;text-align:right">
<ol style="padding:3px 0" onmouseover="return true">
<li class="taf">
// collapsed html for the purposes of this example
<li class="tam">
// collapsed html for the purposes of this example
<li class="tal">
// collapsed html for the purposes of this example
</ol>
<div id="topDnsPrefetchHints">
</div>
如果您获取父节点中的所有HTML,请将其放在某些<html></html>
标记的中间,将其保存到文件中,您基本上可以制作广告的副本。当您打开已保存的页面时,您将看到广告(虽然它没有任何漂亮的格式):
<html>
<head>
</head>
<body>
<span style="margin-right:0" id="taw"> <div></div> <div style="margin:0 0 14px;padding-top:2px;padding-right:36px;padding-bottom:2px;padding-left:8px;min-height:0" id="tads" class="c"><h2 style="font-size:11px;font-weight:normal;margin:0 -35px 0 0;padding:1px 4px 0 0;text-align:right">Ads<span> - <a onclick="google.x(this,function(){if(google.wta){google.wta.toggleLightbox(this,'0CAYQJw','0CAgQKQ',380);}});return false;" id="wtata" class="gl wtall" href="javascript:void(0)">Why these ads?</a><span style="display:none" class="wtalbc">These ads are based on your current search terms.<br><div style="padding-top:12px">Visit Google’s <a class="std gl wtaal" href="#">Ads Preferences Manager</a> to learn more or opt out.</div></span></span></h2><ol style="padding:3px 0" onmouseover="return true"><li class="taf"><div sig="1W8" cved="0CA8Qhw0wAQ" pved="0CA0QhQ0wAQ" class="vsc vsta"><h3 onmouseover="document.getElementById('topDnsPrefetchHints').innerHTML='<link rel="dns-prefetch" href="//www.1800dentist.com">';"><a href="/aclk?sa=L&ai=Cu5IzNnM5T8HqDIim0AHGz6iiCPbdxPwBloiAlyTFyIEGCAAQASgDUNLTqqr8_____wFgyYb_h_Cj7BLIAQGqBBpP0ABwNg99ODa1d9-oVCTsURJpLuG3eTRXOw&sig=AOD64_0uU8rB28uqqP0vfjhLb1rr4cwJAg&ved=0CBAQ0Qw&adurl=http://www.1800dentist.com/lp/dentist/%3Fcid%3Don_ps_g_IL-Chicago-602-Search-GT_Dentist_txt%26dma%3D602%26kw%3Ddentist_e%26refcd%3DGO733T000000517170987s_dentist%26tsacr%3DGO9618667638" id="pa1">Find a Local <b>Dentist</b> - 24/7 Online Appointment Booking.</a></h3><div class="vspib" aria-label="Result details" role="button" tabindex="0"><div class="vspii"><div class="vspiic"></div></div></div><div><div class="kv"><cite>www.1800<b>dentist</b>.com/Chicago<b>Dentist</b></cite></div></div><div><div style="display:none" id="poAs0p1" class="esc slp">You +1'd this publicly. <a class="fl" href="#">Undo</a></div></div><span class="ac">Call or Visit 1-800-<b>DENTIST</b>® Today! </span><div><div style="margin-bottom:0px;margin-top:4px" class="oslk osi"><a href="/aclk?sa=L&ai=CyFBVNnM5T8HqDIim0AHGz6iiCPbdxPwBloiAlyTFyIEGCAAQASgDUOP89dL6_____wFgyYb_h_Cj7BLIAQGqBBpP0ABwNg99ODa1d9-oVCTsURJpLuG3eTRXO_oFCQgDEKbLnUMYAQ&ctype=4&sig=AOD64_2KcTwoGvsakHOnABv0GvJTyXkfHg&ved=0CAsQwgUoAA&adurl=http://www.1800dentist.com/lp/gentle-dentist/%3Fcid%3Don_ps_g_IL-Chicago-602-Search-GT_NA_stl%26kw%3Dfind%2Bgentle%2Bpain-free%2Bdentists%26refcd%3DGO733T000000517170987s_dentist%26tsacr%3DGO9618667638">Find Gentle Pain-Free Dentists</a> - <a href="/aclk?sa=L&ai=CxktKNnM5T8HqDIim0AHGz6iiCPbdxPwBloiAlyTFyIEGCAAQASgDUOL_t8EBYMmG_4fwo-wSyAEBqgQaT9AAcDYPfTg2tXffqFQk7FESaS7ht3k0Vzv6BQkIAxCmy51DGAI&ctype=4&sig=AOD64_0cHm2qsUVFET1ebqMN8f1qdn9cog&ved=0CAwQwgUoAQ&adurl=http://www.1800dentist.com/lp/find-a-dentist/%3Fcid%3Don_ps_g_IL-Chicago-602-Search-GT_NA_stl%26kw%3Dfind%2Ba%2Bdentist%2Bonline%2Bfor%2Bfree!%26refcd%3DGO733T000000517170987s_dentist%26tsacr%3DGO9618667638">Find a Dentist Online for Free</a></div></div></div></li><li class="tam"><div sig="nxV" cved="0CBYQhw0wAg" pved="0CBQQhQ0wAg" class="vsc vsta"><h3 onmouseover="document.getElementById('topDnsPrefetchHints').innerHTML='<link rel="dns-prefetch" href="//dentalsalon.com">';"><a href="/aclk?sa=l&ai=CrohpNnM5T8HqDIim0AHGz6iiCP_r_dQBu-WDqRCMhe4ECAAQAigDULzY_7P-_____wFgyYb_h_Cj7BKgAfWJ4_MDyAEBqgQdT9AAZF8NfTs2tT_fF2GUUAyBnPhpVvtRn2qKVWE&sig=AOD64_0JHw744mqzP1Ep2tAqycGZg0sejA&ved=0CBcQ0Qw&adurl=http://dentalsalon.com" id="pa2"><b>DENTIST</b> at Dental Salon - Super Convenient</a></h3><div class="vspib" aria-label="Result details" role="button" tabindex="0"><div class="vspii"><div class="vspiic"></div></div></div><div><div class="kv"><cite>www.dentalsalon.com/Great-Reviews</cite></div></div><div><div style="display:none" id="poAs0p2" class="esc slp">You +1'd this publicly. <a class="fl" href="#">Undo</a></div></div><span class="ac">Open 7 Days and Evenings - Affordable - 12 <b>Dentists</b> </span><div><div style="margin-bottom:0px;margin-top:0px">Suite 800, 939 W North Ave, Chicago, IL - 1 (312) 642-3370 - <a google.adping('t',2,11)"="" &&="" class="flonmousedown="google.adPing" href="http://maps.google.com/maps?hl=en&um=1&ie=UTF-8&daddr=Suite+800,+939+W+North+Ave,+Chicago,+IL&f=d&saddr=&iwstate1=dir:to&fb=1&geocode=3891923684064231596,41.910331,-87.652690&sa=X&ei=NnM5T9nSC-r20gGymeXFAg&ved=0CBMQmxA">Directions</a></div></div></div></li><li class="tal"><div sig="ohs" cved="0CCAQhw0wAw" pved="0CB4QhQ0wAw" class="vsc vsta"><h3 onmouseover="document.getElementById('topDnsPrefetchHints').innerHTML='<link rel="dns-prefetch" href="//www.BigSmileDental.com">';"><a href="/aclk?sa=l&ai=CXId8NnM5T8HqDIim0AHGz6iiCM3ptXjzxr-0F9OQ_QUIABADKANQn4m4vP7_____AWDJhv-H8KPsEqABj4vz7gPIAQGqBBxP0EBvdAx9Oj61h9yWq5cii-qdqnAgGghZB2eV&sig=AOD64_3TlJu1Y44lD2JjEEkFLOsFSFZPZg&ved=0CCEQ0Qw&adurl=http://www.BigSmileDental.com" id="pa3">Big Smile Dental - $1 Exam & X-Rays or Free Whitening</a></h3><div class="vspib" aria-label="Result details" role="button" tabindex="0"><div class="vspii"><div class="vspiic"></div></div></div><div><div class="kv"><cite>www.bigsmiledental.com</cite></div></div><div><div style="display:none" id="poAs0p3" class="esc slp">You +1'd this publicly. <a class="fl" href="#">Undo</a></div></div><span class="ac">As Seen on FoxNews (773)772-8400 </span><div><div style="margin-bottom:0px;margin-top:4px" class="oslk osi"><a href="/aclk?sa=l&ai=CiPnsNnM5T8HqDIim0AHGz6iiCM3ptXjzxr-0F9OQ_QUIABADKANQ1vWs8QNgyYb_h_Cj7BKgAY-L8-4DyAEBqgQcT9BAb3QMfTo-tYfclquXIovqnapwIBoIWQdnlfoFCQgDEIuk8yMYAQ&ctype=4&sig=AOD64_1nA5osjgI5obezQCRjLFRva-JxqQ&ved=0CBoQwgUoAA&adurl=http://www.bigsmiledental.com/porcelain_veneers.php">Porcelain Veneers</a> - <a href="/aclk?sa=l&ai=CmAknNnM5T8HqDIim0AHGz6iiCM3ptXjzxr-0F9OQ_QUIABADKANQzq2Mgvz_____AWDJhv-H8KPsEqABj4vz7gPIAQGqBBxP0EBvdAx9Oj61h9yWq5cii-qdqnAgGghZB2eV-gUJCAMQi6TzIxgC&ctype=4&sig=AOD64_1gbgrRWKSSEBNajdaYaf3w7uXhEA&ved=0CBsQwgUoAQ&adurl=http://www.bigsmiledental.com/invisalign/index.html">Invisalign</a> - <a href="/aclk?sa=l&ai=CPiH-NnM5T8HqDIim0AHGz6iiCM3ptXjzxr-0F9OQ_QUIABADKANQ56qAgvz_____AWDJhv-H8KPsEqABj4vz7gPIAQGqBBxP0EBvdAx9Oj61h9yWq5cii-qdqnAgGghZB2eV-gUJCAMQi6TzIxgD&ctype=4&sig=AOD64_0LeYmv1UwfXkkdixFJwQ1lxynVIg&ved=0CBwQwgUoAg&adurl=http://www.bigsmiledental.com/1_britesmile.php">Teeth Whitening</a> - <a href="/aclk?sa=l&ai=C87tmNnM5T8HqDIim0AHGz6iiCM3ptXjzxr-0F9OQ_QUIABADKANQlb_v2f3_____AWDJhv-H8KPsEqABj4vz7gPIAQGqBBxP0EBvdAx9Oj61h9yWq5cii-qdqnAgGghZB2eV-gUJCAMQi6TzIxgE&ctype=4&sig=AOD64_14t0h2fqBY_mFSz1f-fh4v177u5g&ved=0CB0QwgUoAw&adurl=http://www.bigsmiledental.com/dental-implants.php">Dental Implants</a></div></div></div></li></ol><div id="topDnsPrefetchHints"><link href="//www.1800dentist.com" rel="dns-prefetch"></div></div> </span>
</body>
</html>
最后,如果您想要漂亮的格式,请参考Google's style sheet,现在您的Google广告的广告几乎完全相同。
注意事项:
最后,由于我已经为提供广告捕获服务的公司(以及更多)工作,我不妨插上our solutions。
我们several examples了解广告在捕获后的外观,包括以下内容: