URLNumberOfAds

Fetches the numbers of ads in the given url.

python · Common Scripts

Details

IDURLNumberOfAds
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10404775
TagsUtility

README

Fetches the numbers of ads in the given URL.

Script Data


Name Description
Script Type python
Tags Utility

Inputs


Argument Name Description
url The URL to load and count ads on.
easylist The optional easylist to get ads from.

Outputs


Path Description Type
Ads.URL The URL ad found. Unknown
Ads.Count The count for the ad found. Unknown
URL.Data The URL that will be checked. Unknown
URL.AdsCount The ads count on the URL. Unknown
import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401
from URLNumberOfAds import ads

HTML_TEXT = """<!doctype html>
<html lang="en">
<head>
<script src="https://ad_url" async></script>
</html>"""


def test_ads():
    term_list = "  \n||ad_url\n##another_url\n"
    res = ads(HTML_TEXT, term_list)
    assert res == {"ad_ur": 1}