tubesentry 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. tubesentry-0.1.2/.agents/skills/youtube-placement-audit/SKILL.md +198 -0
  2. {tubesentry-0.1.0 → tubesentry-0.1.2}/.github/workflows/publish_pypi.yml +4 -0
  3. tubesentry-0.1.2/PKG-INFO +307 -0
  4. tubesentry-0.1.2/README.md +269 -0
  5. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/.vitepress/config.mjs +11 -4
  6. tubesentry-0.1.2/docs/audit.md +16 -0
  7. tubesentry-0.1.2/docs/guide/agent-skill.md +73 -0
  8. tubesentry-0.1.2/docs/guide/bigquery.md +66 -0
  9. tubesentry-0.1.2/docs/guide/google-ads-scripts.md +78 -0
  10. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/guide/pro.md +8 -7
  11. tubesentry-0.1.2/docs/index.md +35 -0
  12. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/public/llms.txt +2 -2
  13. {tubesentry-0.1.0 → tubesentry-0.1.2}/pyproject.toml +3 -3
  14. tubesentry-0.1.2/skills/youtube-placement-audit/SKILL.md +198 -0
  15. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_cli.py +2 -0
  16. tubesentry-0.1.2/tests/test_integrations.py +174 -0
  17. tubesentry-0.1.2/tests/test_skills.py +68 -0
  18. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/__init__.py +40 -12
  19. tubesentry-0.1.2/tubesentry/cli.py +369 -0
  20. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/contracts/schemas.py +22 -0
  21. tubesentry-0.1.2/tubesentry/integrations/__init__.py +9 -0
  22. tubesentry-0.1.2/tubesentry/integrations/bigquery.py +188 -0
  23. tubesentry-0.1.2/tubesentry/integrations/google_ads_script.py +206 -0
  24. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/mcp_server.py +56 -0
  25. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/pro/bridge.py +3 -5
  26. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/pro/installer.py +49 -33
  27. tubesentry-0.1.2/tubesentry/skills/__init__.py +51 -0
  28. tubesentry-0.1.2/tubesentry/skills/youtube_placement_audit/SKILL.md +198 -0
  29. tubesentry-0.1.2/tubesentry/skills/youtube_placement_audit/__init__.py +1 -0
  30. tubesentry-0.1.0/PKG-INFO +0 -234
  31. tubesentry-0.1.0/README.md +0 -196
  32. tubesentry-0.1.0/docs/audit.md +0 -14
  33. tubesentry-0.1.0/docs/index.md +0 -43
  34. tubesentry-0.1.0/tubesentry/cli.py +0 -180
  35. {tubesentry-0.1.0 → tubesentry-0.1.2}/.github/workflows/ci_tests.yml +0 -0
  36. {tubesentry-0.1.0 → tubesentry-0.1.2}/.github/workflows/deploy_docs.yml +0 -0
  37. {tubesentry-0.1.0 → tubesentry-0.1.2}/.gitignore +0 -0
  38. {tubesentry-0.1.0 → tubesentry-0.1.2}/LICENSE +0 -0
  39. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/guide/cli.md +0 -0
  40. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/guide/creative-profiler.md +0 -0
  41. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/guide/mcp-server.md +0 -0
  42. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/guide/python-sdk.md +0 -0
  43. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/guide/quickstart.md +0 -0
  44. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/guide/waste-categories.md +0 -0
  45. {tubesentry-0.1.0 → tubesentry-0.1.2}/docs/public/llms-full.txt +0 -0
  46. {tubesentry-0.1.0 → tubesentry-0.1.2}/package-lock.json +0 -0
  47. {tubesentry-0.1.0 → tubesentry-0.1.2}/package.json +0 -0
  48. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_core_coverage_boost.py +0 -0
  49. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_epro_adapted_features.py +0 -0
  50. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_fixtures.py +0 -0
  51. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_free_auditor.py +0 -0
  52. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_id_extractor.py +0 -0
  53. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_ingestor_multilang.py +0 -0
  54. {tubesentry-0.1.0 → tubesentry-0.1.2}/tests/test_mcp_server.py +0 -0
  55. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/contracts/__init__.py +0 -0
  56. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/contracts/exceptions.py +0 -0
  57. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/contracts/taxonomy.py +0 -0
  58. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/core/__init__.py +0 -0
  59. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/core/auditor.py +0 -0
  60. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/core/heuristics.py +0 -0
  61. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/core/seed_db.py +0 -0
  62. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/io/__init__.py +0 -0
  63. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/io/fixtures.py +0 -0
  64. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/io/ingestor.py +0 -0
  65. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/pro/__init__.py +0 -0
  66. {tubesentry-0.1.0 → tubesentry-0.1.2}/tubesentry/py.typed +0 -0
@@ -0,0 +1,198 @@
1
+ ---
2
+ name: youtube-placement-audit
3
+ description: Audit, score, and eliminate wasted ad spend in Google Ads and DV360 YouTube placement reports using tubesentry and tubesentry-pro.
4
+ version: 0.1.0
5
+ author: flovv
6
+ license: MIT
7
+ platforms: [linux, macos, windows]
8
+ metadata:
9
+ hermes:
10
+ tags: [youtube, google-ads, dv360, pmax, placement-audit, brand-safety, coppa, exclusions, mcp-server]
11
+ related_skills: []
12
+ ---
13
+
14
+ # YouTube Placement Audit Skill (`youtube-placement-audit`)
15
+
16
+ Audits, scores, and eliminates wasted ad budget from Google Ads and DV360 YouTube and Performance Max (PMax) placement reports:
17
+ - **`tubesentry` (Open-Core):** Automated ingestion of multilingual Google Ads / DV360 CSV placement exports, 6-vector heuristic waste detection (Made-for-Kids toddler content, passive audio/sleep music, underage gaming, foreign script leakage, low-quality content farms, performance sinkholes), bundled 2,500-channel seed database, Top 25 unmasked diagnostic reporting, and FastMCP Server for Claude Desktop, Cursor, and AI agents.
18
+ - **`tubesentry-pro` (Commercial):** 250,000-channel pre-classified intelligence registry (PyArrow zstd Parquet), asynchronous 50-ID batch YouTube Data API v3 enricher with local SQLite cache, Google Ads 65,000-channel exclusion shield quantizer (`google_ads_65k_full_shield.csv`), interactive CFO / Client HTML pitch deck with visual proof cards, Wikipedia Knowledge Graph topic entity breakdowns, and impression-weighted quality scoring (1–10).
19
+
20
+ > [!IMPORTANT]
21
+ > **Division of Responsibilities:**
22
+ > * **The Engine (`tubesentry` / `tubesentry_pro`) executes all data processing:** Never write custom CSV parsing loops, manual regexes, or custom YouTube API batching. Always invoke `audit_placements()`, `run_free_audit()`, or the CLI/MCP tools.
23
+ > * **The Agent formats inputs and guides decisions:** Identify placement report columns, inspect flag rationales, check language/geotargeting alignment, review the visual evidence, and guide media buyers on deploying the 65k exclusion shield into Google Ads Editor.
24
+ > * **Exclusion vs. Bidding Distinction:** YouTube placement exclusions actively prevent ads from serving on flagged channels. Placement exclusions applied at the campaign or account level are hard blocks enforced by Google's ad server.
25
+
26
+ ---
27
+
28
+ ## Pro Licensing & Availability
29
+
30
+ Check whether Pro is available:
31
+ ```python
32
+ import tubesentry
33
+ is_pro = tubesentry.is_pro_available()
34
+ ```
35
+
36
+ Pro requires a Polar license key or test key:
37
+ - **Environment Variable:** `os.environ["TUBESENTRY_API_KEY"] = "TS_PRO_..."`
38
+ - **Parameter:** Pass `api_key="TS_PRO_..."` directly into `audit_placements()`.
39
+ - **Local Dev / CI Bypass:** Set `os.environ["TUBESENTRY_MOCK_AUTH"] = "1"` or use a test key prefixed with `TS_TEST_`.
40
+
41
+ ---
42
+
43
+ ## Quick Reference: CLI Commands
44
+
45
+ | Task | Command |
46
+ | :--- | :--- |
47
+ | **Run Placement Audit** | `tubesentry audit <report.csv> [--cpa 15.0] [--export-script cleanup.js] [--html report.html] [--ad-url <url>]` |
48
+ | **Export Google Ads Script** | `tubesentry export script --report <report.csv> --out cleanup.js [--dry-run/--live]` |
49
+ | **Export BigQuery SQL** | `tubesentry export bigquery --out audit.sql [--dataset <name>] [--dbt]` |
50
+ | **Generate Demo Data** | `tubesentry demo --out-dir demo --rows 500` |
51
+ | **Start FastMCP Server** | `tubesentry mcp` |
52
+ | **Install Agent Skill** | `tubesentry skill install [--target-dir .agents/skills]` |
53
+ | **Show Skill Guide** | `tubesentry skill show` |
54
+ | **Authenticate Pro** | `tubesentry auth --key <TS_PRO_...>` |
55
+
56
+ ---
57
+
58
+ ## Creative Targeting Fit Engine (Gemini Profiler)
59
+
60
+ Given an ad creative URL or brief, TubeSentry invokes Gemini to infer:
61
+ 1. Ideal Customer Profile (ICP) & decision-maker roles.
62
+ 2. Recommended contextual topic entities (Wikipedia / Knowledge Graph).
63
+ 3. Negative anti-personas (Made-for-Kids, underage gaming, passive audio, content farms).
64
+ 4. Correlates intent against actual placement delivery to compute the **Targeting Alignment Score (1–10)**, on-target vs. off-target spend, and side-by-side **Expectation vs. Reality** comparison cards in the HTML report.
65
+
66
+ ```python
67
+ from tubesentry import audit_placements
68
+
69
+ report = audit_placements(
70
+ report="campaign_placements.csv",
71
+ api_key="TS_PRO_KEY",
72
+ export_html_deck="cfo_audit_deck.html",
73
+ ad_url="https://youtube.com/watch?v=...",
74
+ ad_text="Enterprise Kubernetes orchestration and cloud cost optimization platform for DevOps teams.",
75
+ )
76
+
77
+ print(f"Alignment Score: {report.creative_alignment.overall_alignment_score} / 10")
78
+ print(f"Off-Target Bleed: EUR {report.creative_alignment.off_target_spend:,.2f} ({report.creative_alignment.off_target_percentage}%)")
79
+ ```
80
+
81
+ ---
82
+
83
+ ## FastMCP Server Integration
84
+
85
+ `tubesentry` includes a native FastMCP server (`tubesentry.mcp_server`) exposing placement auditing tools directly to Claude Desktop, Cursor, and AI agents.
86
+
87
+ ### Claude Desktop Configuration (`claude_desktop_config.json`)
88
+ ```json
89
+ {
90
+ "mcpServers": {
91
+ "tubesentry": {
92
+ "command": "uvx",
93
+ "args": ["--from", "tubesentry", "tubesentry-mcp"],
94
+ "env": {
95
+ "TUBESENTRY_API_KEY": "TS_PRO_..."
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Available MCP Tools
103
+
104
+ 1. **`audit_placement_report(csv_path, target_languages, target_cpa, api_key, output_dir, ad_url, ad_text, gemini_api_key)`**:
105
+ Audits a Google Ads or DV360 placement CSV report. When Pro is active or `api_key` is provided, automatically outputs:
106
+ - `google_ads_reactive_exclusions.csv` (all flagged placements in the campaign)
107
+ - `google_ads_65k_full_shield.csv` (quantized 65k account-level exclusion shield)
108
+ - `youtube_waste_audit.html` (interactive CFO presentation deck)
109
+ 2. **`inspect_youtube_channels(channel_ids_or_urls, target_languages, api_key)`**:
110
+ Queries individual channel IDs or URLs against the Seed DB, 250k Pro Registry, and heuristics. Returns waste category, confidence, and detection source.
111
+ 3. **`profile_creative_intent(ad_url, ad_text, gemini_api_key)`**:
112
+ Extracts target ICP, recommended contextual topics, and anti-personas from video URL or text brief.
113
+ 4. **`activate_tubesentry_pro(api_key)`**:
114
+ Validates license key against Polar and activates Pro.
115
+
116
+ ---
117
+
118
+ ## Essential Code Recipes
119
+
120
+ ### Recipe 1: Run Placement Audit & Export Exclusions
121
+ ```python
122
+ import tubesentry
123
+
124
+ report = tubesentry.audit_placements(
125
+ report="google_ads_placements.csv",
126
+ target_languages=["de", "en"],
127
+ target_cpa=25.0,
128
+ api_key="TS_PRO_...",
129
+ export_exclusions_csv="output/reactive_exclusions.csv",
130
+ export_65k_shield_csv="output/shield_65k.csv",
131
+ export_html_deck="output/deck.html",
132
+ )
133
+
134
+ print(f"Audited Spend: EUR {report.total_spend:,.2f}")
135
+ print(f"Wasted Spend: EUR {report.total_wasted_spend:,.2f} ({report.wasted_spend_percentage:.1f}%)")
136
+ print(f"Quality Score: {report.weighted_quality_score:.1f} / 10.0")
137
+ print(f"Exclusions generated: {len(report.top_offenders):,} channels")
138
+ ```
139
+
140
+ ### Recipe 2: Inspect Specific Channels in Agent Conversations
141
+ ```python
142
+ from tubesentry.mcp_server import inspect_youtube_channels
143
+
144
+ results = inspect_youtube_channels([
145
+ "UCbCmjCuTUZos6Inko4u57UQ", # Cocomelon
146
+ "https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow", # Lofi Girl
147
+ "https://www.youtube.com/channel/UCBJycsmduvYEL83R_U4JriQ", # MKBHD (Clean)
148
+ ])
149
+
150
+ for r in results:
151
+ print(f"[{r['waste_category']}] {r['channel_title']} (Confidence: {r['waste_confidence']:.2f})")
152
+ print(f" Reason: {r['reason_summary']}")
153
+ ```
154
+
155
+ ### Recipe 3: Statistical Proportional Sampling for Huge CSVs
156
+ For reports with 20,000+ placements under API limits, sample proportional to impression volume:
157
+ ```python
158
+ from tubesentry.io.ingestor import load_placement_report, sample_by_impressions
159
+
160
+ df = load_placement_report("massive_placements_report.csv")
161
+ sample_df = sample_by_impressions(df, n=500)
162
+ ```
163
+
164
+ ### Recipe 4: Generate Copy-Paste Google Ads Exclusion Script
165
+ Output a complete `.js` file for Google Ads Scripts to automate account-level exclusions:
166
+ ```python
167
+ from tubesentry import generate_google_ads_script
168
+
169
+ channels = ["UCbCmjCuTUZos6Inko4u57UQ", "UCSJ4gkVC6NrvII8umztf0Ow"]
170
+ script_js = generate_google_ads_script(
171
+ channel_ids_or_urls=channels,
172
+ dry_run=True,
173
+ shared_list_name="TubeSentry Waste Shield",
174
+ )
175
+ ```
176
+
177
+ ### Recipe 5: BigQuery DTS SQL Macro for Enterprise Warehouses
178
+ Generate an audit query to run directly on Google Ads BigQuery Data Transfer Service tables:
179
+ ```python
180
+ from tubesentry import generate_bigquery_dts_sql
181
+
182
+ sql = generate_bigquery_dts_sql(dataset="google_ads_export", lookback_days=30, as_dbt=True)
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Best Practices & Decision Rules
188
+
189
+ 1. **Impression-Weighted Loss over Raw Channel Count:**
190
+ Never report waste solely as "X% of channels." A handful of toddler channels can consume 40%+ of impressions. Always report **Impression Waste Impact** and **Placement Quality Index**.
191
+ 2. **Toddler Tap Waste (<10) vs. Adult Content:**
192
+ Treat toddler content (`is_young_kids == True`) as high-urgency waste. Toddlers accidentally tap screens, causing near-100% bounce rates and COPPA compliance risk.
193
+ 3. **Passive Music & Audio Streams:**
194
+ Flag lo-fi, sleep music, and 10-hour ambient streams as zero-attention placements unless the campaign is explicitly audio-first.
195
+ 4. **Google Ads 65,000 Exclusion Limit:**
196
+ Google Ads limits account-level exclusion lists to 65,000 items. When generating account shields, `tubesentry_pro` quantizes the 250,000 registry into the top 65,000 highest-risk channels.
197
+ 5. **Language Alignment Validation:**
198
+ Always inspect campaign target languages. A Spanish channel is waste leakage on a German domestic campaign, but completely legitimate on a LATAM campaign. Use `target_languages` appropriately.
@@ -10,6 +10,9 @@ jobs:
10
10
  build-and-publish:
11
11
  name: Build and publish to PyPI
12
12
  runs-on: ubuntu-latest
13
+ permissions:
14
+ id-token: write
15
+ contents: read
13
16
 
14
17
  steps:
15
18
  - uses: actions/checkout@v4
@@ -31,3 +34,4 @@ jobs:
31
34
  uses: pypa/gh-action-pypi-publish@release/v1
32
35
  with:
33
36
  password: ${{ secrets.PYPI_API_TOKEN }}
37
+ skip-existing: true
@@ -0,0 +1,307 @@
1
+ Metadata-Version: 2.5
2
+ Name: tubesentry
3
+ Version: 0.1.2
4
+ Summary: Local-First YouTube & Performance Max Placement Waste Auditor & MCP Server
5
+ Project-URL: Homepage, https://flovv.github.io/tubesentry
6
+ Project-URL: Documentation, https://flovv.github.io/tubesentry/guide/quickstart
7
+ Project-URL: Repository, https://github.com/flovv/tubesentry
8
+ Project-URL: Changelog, https://github.com/flovv/tubesentry/releases
9
+ Author: TubeSentry Core Team
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: claude-desktop,dv360,google-ads,made-for-kids,mcp-server,model-context-protocol,performance-max,placement-exclusions,youtube-ads
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: httpx>=0.25.0
25
+ Requires-Dist: mcp<2.0.0,>=1.2.0
26
+ Requires-Dist: numpy>=1.24.0
27
+ Requires-Dist: pandas>=2.0.0
28
+ Requires-Dist: pyarrow>=14.0.0
29
+ Requires-Dist: pydantic>=2.5.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Requires-Dist: typer>=0.9.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
34
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
35
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.2.0; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # TubeSentry
40
+
41
+ Local-first placement auditor and Model Context Protocol (MCP) server for Google Ads and DV360.
42
+
43
+ [![CI Tests](https://github.com/flovv/tubesentry/actions/workflows/ci_tests.yml/badge.svg)](https://github.com/flovv/tubesentry/actions/workflows/ci_tests.yml)
44
+ [![Documentation](https://github.com/flovv/tubesentry/actions/workflows/deploy_docs.yml/badge.svg)](https://flovv.github.io/tubesentry/)
45
+ [![PyPI version](https://img.shields.io/pypi/v/tubesentry.svg)](https://pypi.org/project/tubesentry/)
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
47
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://www.python.org/)
48
+ [![M8ven Verified](https://m8ven.ai/badge/mcp/flovv-tubesentry-vkj518?v=8dc4fcf3c83d08d489cf708727c98799&variant=verified)](https://m8ven.ai/mcp/flovv-tubesentry-vkj518?s=readme)
49
+
50
+ **Documentation:** [https://flovv.github.io/tubesentry/](https://flovv.github.io/tubesentry/)
51
+
52
+ ---
53
+
54
+ ## Description
55
+
56
+ TubeSentry analyzes placement reports ("Where ads showed") from Google Ads (YouTube, Performance Max, Demand Gen) and Google Display & Video 360 (DV360). It categorizes placements against known risk patterns, quantifies wasted media spend, calculates an impression-weighted quality score, and generates exclusion lists for Google Ads Editor.
57
+
58
+ Processing runs 100% locally. Client placement data, impressions, and budgets never leave your machine.
59
+
60
+ **Tags:** `google-ads`, `youtube-ads`, `performance-max`, `dv360`, `adtech`, `ppc`, `mcp-server`, `placement-exclusions`, `marketing-analytics`
61
+
62
+ ---
63
+
64
+ ## What TubeSentry Detects
65
+
66
+ When running YouTube or Performance Max campaigns, broad placement algorithms frequently allocate budget to non-converting or unintended inventory:
67
+
68
+ * **Made for Kids (MFK):** Toddler songs and children's cartoons streamed on shared mobile devices, leading to accidental taps and COPPA compliance concerns.
69
+ * **Passive Audio & Music:** 24/7 background lo-fi streams, ambient sleep tracks, and white-noise loops where visual engagement is minimal.
70
+ * **Underage Gaming:** Channels dedicated to mobile sandbox titles (Roblox, Minecraft) that generate high view counts with negligible conversion value.
71
+ * **Foreign Script Delivery:** Placements running on non-target language scripts (Cyrillic, Devanagari, Arabic, Thai) within domestic campaigns.
72
+ * **Low-Quality Content Farms:** Automated short-form compilations designed for view arbitrage with high bounce rates.
73
+ * **Performance Sinkholes:** Placements that exceed 3x target CPA without registering conversions.
74
+ * **Creative Alignment Gap:** Optional analysis comparing your creative's intended target audience with the actual channels where impressions ran.
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ ```bash
81
+ pip install tubesentry
82
+ ```
83
+
84
+ Or run directly without installation using `uvx`:
85
+
86
+ ```bash
87
+ uvx --from tubesentry tubesentry --help
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Quickstart
93
+
94
+ ### 1. Run a Synthetic Demo Audit
95
+
96
+ Generate a 25,000-row synthetic placement report and review the audit output:
97
+
98
+ ```bash
99
+ tubesentry demo --out-dir ./demo_output
100
+ ```
101
+
102
+ ### 2. Audit an Exported Placement CSV
103
+
104
+ Export your placement report from Google Ads (*Reports > Predefined reports > Other > Where ads showed > Download CSV*) or DV360:
105
+
106
+ ```bash
107
+ tubesentry audit where_ads_showed.csv --lang en,de --cpa 45.0
108
+ ```
109
+
110
+ ### 3. Compare Creative Intent to Actual Delivery
111
+
112
+ Pass your YouTube ad URL or creative brief text to compare target audience expectations against delivery reality:
113
+
114
+ ```bash
115
+ tubesentry audit where_ads_showed.csv \
116
+ --ad-url "https://youtube.com/watch?v=your_ad_id" \
117
+ --ad-text "B2B infrastructure platform for DevOps and cloud architects"
118
+ ```
119
+
120
+ ### 4. Export Google Ads JavaScript Automation
121
+
122
+ Generate a copy-paste Google Ads Script snippet that automatically creates or populates an account-level Shared Placement Exclusion List:
123
+
124
+ ```bash
125
+ tubesentry audit where_ads_showed.csv --export-script cleanup_placements.js
126
+ ```
127
+
128
+ Paste into Google Ads (*Tools & Settings > Bulk Actions > Scripts*) and schedule to run daily or weekly.
129
+
130
+ ---
131
+
132
+ ## Integrations
133
+
134
+ ### Google Ads Scripting Ecosystem
135
+
136
+ For media buyers who maintain automation by pasting JavaScript snippets into Google Ads, TubeSentry outputs a self-contained script with a built-in `DRY_RUN` preview mode:
137
+
138
+ ```bash
139
+ tubesentry export script --report where_ads_showed.csv --out cleanup.js --list-name "TubeSentry Waste Shield"
140
+ ```
141
+
142
+ * **Shared List Mode (Default):** Applies exclusions account-wide across Video, Performance Max, and Demand Gen campaigns without hitting individual campaign limits.
143
+ * **Campaigns Mode:** Targets specific campaigns matching a name filter via `--mode CAMPAIGNS`.
144
+ * **Safe Preview:** Defaults to `DRY_RUN = true` so media buyers can review logs before applying live exclusions.
145
+
146
+ ### BigQuery Data Transfer Service (DTS) & dbt
147
+
148
+ For analytics and data engineering teams querying raw Google Ads Data Transfer Service tables (`p_Placement_*`), TubeSentry generates an optimized BigQuery Standard SQL query:
149
+
150
+ ```bash
151
+ # Standard BigQuery SQL query
152
+ tubesentry export bigquery --out tubesentry_audit.sql --dataset google_ads_export
153
+
154
+ # dbt model format (with partitioning and clustering)
155
+ tubesentry export bigquery --out models/tubesentry_audit.sql --dbt
156
+ ```
157
+
158
+ Evaluates heuristics (Made-for-Kids, passive audio, underage gaming, foreign language scripts) directly in BigQuery without moving data out of your data warehouse.
159
+
160
+ ---
161
+
162
+ ## Python API
163
+
164
+ TubeSentry supports localized Google Ads CSV exports (English, German, Spanish, French, Italian, Dutch):
165
+
166
+ ```python
167
+ import tubesentry as ts
168
+
169
+ report = ts.audit_placements(
170
+ report="where_ads_showed.csv",
171
+ target_languages=["en", "de"],
172
+ target_cpa=40.0,
173
+ ad_url="https://youtube.com/watch?v=your_ad_id",
174
+ ad_text="B2B cloud infrastructure monitoring for SRE teams.",
175
+ )
176
+
177
+ print(f"Audited Spend: EUR {report.total_spend:,.2f}")
178
+ print(f"Wasted Spend: EUR {report.total_wasted_spend:,.2f} ({report.wasted_spend_percentage:.1f}%)")
179
+ print(f"Quality Score: {report.weighted_quality_score:.1f} / 10.0")
180
+
181
+ if report.creative_alignment:
182
+ print(f"Alignment Score: {report.creative_alignment.overall_alignment_score:.1f} / 10.0")
183
+ print(f"Off-Target Spend: EUR {report.creative_alignment.off_target_spend:,.2f}")
184
+ ```
185
+
186
+ ---
187
+
188
+ ## MCP Server (Claude Desktop, Claude Code, Cursor)
189
+
190
+ TubeSentry includes a native Model Context Protocol (FastMCP) server, allowing AI coding assistants and agents to inspect placements and channels directly.
191
+
192
+ ### Claude Desktop Configuration
193
+
194
+ Add to `claude_desktop_config.json`:
195
+
196
+ ```json
197
+ {
198
+ "mcpServers": {
199
+ "tubesentry": {
200
+ "command": "uvx",
201
+ "args": ["--from", "tubesentry", "tubesentry-mcp"]
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ ### Cursor Configuration
208
+
209
+ Add to `.cursor/mcp.json`:
210
+
211
+ ```json
212
+ {
213
+ "mcpServers": {
214
+ "tubesentry": {
215
+ "command": "uvx",
216
+ "args": ["--from", "tubesentry", "tubesentry-mcp"]
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Agent Skill
225
+
226
+ TubeSentry includes an installable skill (`youtube-placement-audit`) formatted with standard frontmatter for AI coding assistants and agent environments (Claude Code, Cursor, Antigravity, Codex).
227
+
228
+ ### Install via skills.sh / npx
229
+
230
+ Install directly to your agent configuration using the open skills standard:
231
+
232
+ ```bash
233
+ npx skills add flovv/tubesentry
234
+ ```
235
+
236
+ ### Install via TubeSentry CLI
237
+
238
+ ```bash
239
+ tubesentry skill install
240
+ ```
241
+
242
+ Or run without installation via `uvx`:
243
+
244
+ ```bash
245
+ uvx --from tubesentry tubesentry skill install
246
+ ```
247
+
248
+ This places `SKILL.md` into your workspace (`.agents/skills/` or `.claude/skills/`), providing autonomous agents with:
249
+ * Operational recipes for analyzing Google Ads / DV360 placement reports
250
+ * Waste category decision rules and CPA thresholds
251
+ * FastMCP tool invocation patterns and creative targeting fit guides
252
+
253
+ To view the raw skill instructions directly in the terminal:
254
+
255
+ ```bash
256
+ tubesentry skill show
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Editions
262
+
263
+ | Feature | Open-Core (Free) | Pro (Licensed) |
264
+ | :--- | :--- | :--- |
265
+ | Waste category breakdown and percentage | Yes | Yes |
266
+ | Impression-weighted quality score (1-10) | Yes | Yes |
267
+ | Worst-offender channel reporting | Top 25 unmasked | All unmasked |
268
+ | Bundled waste seed database | Curated seed channels + heuristics | Curated seed DB + Parquet index & SQLite cache |
269
+ | Channel metadata resolution | Local heuristics | 50-ID batch YouTube API v3 enricher |
270
+ | Google Ads Editor exclusion CSV | No | Yes (reactive & 65k-capped exclusion CSVs) |
271
+ | DV360 SDF exclusion chunks | No | Yes (10,000-row SDF blocks) |
272
+ | Creative targeting fit engine | Core matching | Multimodal creative profiler |
273
+ | Client HTML presentation deck | No | Yes (single-file HTML report) |
274
+
275
+ ---
276
+
277
+ ## Pro Activation
278
+
279
+ TubeSentry Pro (Monthly, $199/mo) is available via [Polar](https://buy.polar.sh/polar_cl_lRuifr3uJS0LR0k6frhg3JEKBRZNQq75hv7cS2am9cX).
280
+
281
+ After purchasing, download your platform wheel (`.whl`) from the [Polar Customer Portal](https://polar.sh/spotlift/portal) and activate via CLI:
282
+
283
+ ```bash
284
+ tubesentry auth --key tube_-XXXX-XXXX-XXXX --wheel path/to/tubesentry_pro-*.whl
285
+ ```
286
+
287
+ Or via Python:
288
+
289
+ ```python
290
+ import tubesentry as ts
291
+
292
+ ts.install_pro(api_key="tube_-XXXX-XXXX-XXXX", local_path="path/to/tubesentry_pro-*.whl")
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Security & Privacy
298
+
299
+ * **Local execution:** All CSV parsing, heuristic scoring, and database lookups run locally.
300
+ * **No cloud ingestion:** Client spend numbers, impressions, and account identifiers are never transmitted to external servers.
301
+ * **No telemetry:** The core package does not collect analytics or track usage.
302
+
303
+ ---
304
+
305
+ ## License
306
+
307
+ MIT License. See [LICENSE](LICENSE) for details.