Assanlab - JSON input data with counts on how many times you showed an ad on each individual domain

JSON input data with counts on how many times you showed an ad on each individual domain. Every line consists of a count and a domain name. Write a function that interprets this input and outputs the number of hits that were recorded on each domain AND any domain under it.

You are in charge of a display advertising program. Your ads are displayed on websites all over the internet. You have some JSON input data that counts how many times that users have clicked on an ad on each individual domain. Every line consists of a click count and a domain name, like this:

Sample input data -

[

[900,"google.com" ],

[60,"mail.yahoo.com" ],

[10,"mobile.sports.yahoo.com" ],

[40,"sports.yahoo.com" ],

[300,"yahoo.com" ],

[10,"stackoverflow.com" ],

[20,"overflow.com" ],

[5,"com.com" ],

[2,"en.wikipedia.org" ],

[1,"m.wikipedia.org" ],

[1,"mobile.sports" ],

[1,"google.co.uk" ]

]

Write a function that takes this input as a parameter and returns a data structure containing the number of clicks that were recorded on each domain AND each subdomain under it. For example, a click on "mail.yahoo.com" counts toward the totals for "mail.yahoo.com", "yahoo.com", and "com". (Subdomains are added to the left of their parent domain. So "mail" and "mail.yahoo" are not valid domains. Note that "mobile.sports" appears as a separate domain near the bottom of the input.)

Expected Output

Sample output (in any order/format):

com: 1345

google.com: 900

stackoverflow.com: 10

overflow.com: 20

yahoo.com: 410

mail.yahoo.com: 60

mobile.sports.yahoo.com: 10

sports.yahoo.com: 50

com.com: 5

org: 3

wikipedia.org: 3

en.wikipedia.org: 2

m.wikipedia.org: 1

mobile.sports: 1

sports: 1

uk: 1

co.uk: 1

google.co.uk: 1

Similar Resources

llb - It's a very simple but quick backend for proxy servers. Can be useful for fast redirection to predefined domain with zero memory allocation and fast response.

llb What the f--k it is? It's a very simple but quick backend for proxy servers. You can setup redirect to your main domain or just show HTTP/1.1 404

Sep 27, 2022

Support for Unix domain sockets in Go HTTP clients

unixtransport This package adds support for Unix domain sockets in Go HTTP clients. t := &http.Transport{...} unixtransport.Register(t) client := &h

Dec 21, 2022

Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com).

Go Modules Remote Import Path Proxy Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com). For example Uber (buil

Nov 2, 2021

🛡 Several domain lists compiled into a database file used by V2Ray.

Domain list database This project is pulled from v2fly/domain-list-community, with only its data changed to use several blocklists. Purpose of this pr

May 22, 2022

Serve traffic (HTTP/gRPC) over SSH using Domain Sockets

Serve On SSH Introduction There is often a need to offer services for administrative purposes on servers or even for microservices that are running on

Nov 10, 2022

Automatically register a list of domain names, add them to Cloudflare and set DNS records.

NameCannon Automatically register a list of domain names, add them as zones on Cloudflare, then add DNS records. Usage $ ./NameCannon --namesiloSecret

Jan 26, 2022

Transparent TLS and HTTP proxy serve and operate on all 65535 ports, with domain regex whitelist and rest api control

goshkan Transparent TLS and HTTP proxy serve & operating on all 65535 ports, with domain regex whitelist and rest api control tls and http on same por

Nov 5, 2022

Simple forwarding a unix domain socket to a local port.

WaziApp Proxy WaziApp proxy is a simple http proxy that is intended to listen on the WaziApp unix socket /var/lib/waziapp/proxy.sock and forwards to a

Nov 18, 2021

Extract domain from SSL Information

Extract domain from SSL Information

Dec 7, 2022
Related tags
Benthos-input-grpc - gRPC custom benthos input

gRPC custom benthos input Create a custom benthos input that receives messages f

Sep 26, 2022
Splits heat 1 from the feature race to make it easy to upload multi-heat races to simracerhub as individual races

simracerhub_heat_splitter Splits heat 1 from the feature race to make it easy to upload multi-heat races to simracerhub as individual races Install Yo

Jan 9, 2022
Service that calls uzma24/project1 service, takes input from .txt file and prints JSON output returned from the service.

Service that calls uzma24/project1 service, takes input from .txt file and prints JSON output returned from the service. Program can take large input files.

Feb 6, 2022
Kiara is a Go equivalent of Phoenix PubSub that makes it easy for Go applications to communicate with each other.
Kiara is a Go equivalent of Phoenix PubSub that makes it easy for Go applications to communicate with each other.

Kiara is a Go equivalent of Phoenix PubSub that makes it easy for Go applications to communicate with each other. Examples Basic Usage Custom Co

Nov 1, 2022
Parse any web page for URLs and return the HTTP response code of each one.
Parse any web page for URLs and return the HTTP response code of each one.

ParseWebPage - Fully Functional WebPage Parser Parse any web page for URLs and return the HTTP response code of each one. Creators ?? Steven Williams

Oct 25, 2021
Get subdomain list and check whether they are active or not by each response code. Using API by c99.nl
Get subdomain list and check whether they are active or not by each response code. Using API by c99.nl

getsubdomain Get subdomain list and check whether they are active or not by each response code. Using API by c99.nl Installation ▶ go install github.c

Oct 24, 2022
Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes.

DNS-Updater Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes. Motivation Havin

Mar 10, 2022
Data Connector is a Google Sheets Add-on that lets you import (and export) data to/from Google Sheets

Data Connector Data Connector is a Google Sheets Add-on that lets you import (and export) data to/from Google Sheets. Our roadmap: Connect to JSON/XML

Jul 30, 2022
A Xray backend framework that can easily support many panels. 一个基于Xray的后端框架,支持V2ay,Trojan,Shadowsocks协议,极易扩展,支持多面板对接

XRayR A Xray backend framework that can easily support many panels. 一个基于Xray的后端框架,支持V2ay,Trojan,Shadowsocks协议,极易扩展,支持多面板对接。 如果您喜欢本项目,可以右上角点个star+watch

Jan 4, 2023
many tools implemented in Golang

Go-Tools many tools implemented in Golang tools project comments abtest AB测试分流 dag_flow DAG工作流 hugo_themes Hugo主题 log_monitor 日志监控服务 pepper_cache 内存kv

Dec 12, 2021