开发者

Script to download ads in a page

I want to downlaod the ads present in a page. Can anyone give me some ideas how to do this.Or do you know any pl开发者_C百科ugin which does this. I looked into plugins which block ads and was trying to use them to download the ads.

When I open a page in a browser i need to download all the ads which are present on that page. So I need to write a plugin or an add on to do that? I need to collect ads for one of my project.


I am not certain exactly what logic you'd use to identify which images/objects are ads and which are not, but you could use the GreaseMonkey Firefox add-on to script this.

In a nutshell, you'd have to loop through all suspect elements (we'll say images and objects) and check their src property. If an element is identified as an advertisement, pass that URL on to a webserver (could be localhost or hosted online) that will grab the file and save it.

Otherwise, I am pretty certain that the security restrictions of javascript/chrome/XUL are such that you aren't going to be able to take arbitrary content from online and write to the the local computer's hard drive silently. Imagine the security risks that would entail!


Well, you could try and make some kind of browser add-on which triggers on each page load, and then use AdBlock's lists such as this one to identify advertisements and download them. Downside is you would be making something extremely browser-dependent and you would have to parse the same kind of rules.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜