Published

๐Ÿ“ Google Apps Script Files

๐Ÿ“ Google Apps Script Files

This folder contains all Google Apps Script (GAS) files for the Tokyo VPN Speed Monitor system.

๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Main Spreadsheet                            โ”‚
โ”‚  (Speed Data, Price History, Outage, News, Reports)             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                 โ”‚
โ”‚  vpn-speed-tracker.gs             โ”€โ”€โ”€โ”€โ”€โ”                       โ”‚
โ”‚  price-scraper.gs           โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ–บ Data Collection    โ”‚
โ”‚  outage-detection.gs                  โ”€โ”ค                       โ”‚
โ”‚  news-monitor.gs                 โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                       โ”‚
โ”‚                                                                 โ”‚
โ”‚  twitter-poster.gs            โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Notifications     โ”‚
โ”‚  price-alert.gs          โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ                   โ”‚
โ”‚                                                                 โ”‚
โ”‚  market-report.gs             โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Reporting         โ”‚
โ”‚  weekly-digest.gs      โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ                   โ”‚
โ”‚                                                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              Separate Spreadsheet (Trust Score)                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  trust-score.gs             โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Trust Evaluation  โ”‚
โ”‚  (Uses Claude API for automated assessment)                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“„ File Descriptions

Core Engines

FileEngineDescriptionTrigger
speed-tracker.gs1Speed measurement for 15 VPNsEvery 6 hours
price-scraper.gs2aPrice scraping with ScraperAPIDaily 9:00 AM
price-alert.gs2a+Price change detection & alertsAfter price scraping
outage-detection.gs2bStatistical anomaly detectionHourly
news-monitor.gs2b+Google News RSS monitoringEvery 6 hours

Notification & Reporting

FileDescriptionTrigger
twitter-poster.gsTwitter OAuth 1.0a posting (speed + trust)10:00, 15:00, 20:00 / Monthly 1st
weekly-digest.gsWeekly newsletter digest generatorMonday 9:00 AM
market-report.gsQuarterly market report with PDFQuarterly 1st

Trust Score (Separate Project)

FileDescriptionTrigger
trust-score.gsClaude API-based trust evaluationMonthly 1st, 10:00

Configuration

FileDescription
config.example.gsConfiguration template (copy to config.gs)

๐Ÿ”ง Setup Instructions

Step 1: Main Spreadsheet Setup

  1. Create a new Google Spreadsheet

  2. Go to Extensions โ†’ Apps Script

  3. Copy the following files:

    • speed-tracker.gs
    • price-scraper.gs
    • price-alert.gs
    • outage-detection.gs
    • news-monitor.gs
    • twitter-poster.gs
    • weekly-digest.gs
    • market-report.gs
    • config.example.gs โ†’ rename to config.gs and fill in values
  4. Create required sheets:

    • ้€Ÿๅบฆใƒ‡ใƒผใ‚ฟ
    • VPNๆ–™้‡‘ๅฑฅๆญด
    • VPN้šœๅฎณๆคœ็Ÿฅ๏ผˆ้ซ˜ๅบฆ๏ผ‰
    • VPNใƒ‹ใƒฅใƒผใ‚นๅฑฅๆญด
    • VPNๆฅญ็•Œ็ตฑ่จˆใƒฌใƒใƒผใƒˆ
    • ้€ฑๆฌกใƒ€ใ‚คใ‚ธใ‚งใ‚นใƒˆ

Step 2: Trust Score Setup (Separate Project)

  1. Create a new Google Spreadsheet for Trust Score
  2. Go to Extensions โ†’ Apps Script
  3. Copy vpn-trust-score-system.gs
  4. Set Script Property: CLAUDE_API_KEY = your Anthropic API key
  5. Run initialSetup() to create sheets
  6. Deploy as Web App
  7. Copy the deployed URL to main project's config

Step 3: Set Script Properties

In the main project, set these Script Properties:

PropertyDescription
SCRAPERAPI_KEYScraperAPI key for price scraping

In the Trust Score project:

PropertyDescription
CLAUDE_API_KEYAnthropic API key for Claude

Step 4: Configure Triggers

Run these setup functions once:

// In main project:
setupTriggers();           // Speed measurement (6h)
setupPriceAlertTriggers(); // Price scraping (daily)
setupAdvancedOutageDetectionTriggers(); // Outage (hourly)
setupNewsMonitorTriggers(); // News (6h)
setupAllTriggers();        // Twitter posting
setupWeeklyDigestTrigger(); // Newsletter (weekly)
setupQuarterlyReportTrigger(); // Report (quarterly)

// In Trust Score project:
setupMonthlyTrigger();     // Trust evaluation (monthly)

Step 5: Deploy Web Apps

Deploy each project as a Web App:

  1. Main Project (Speed/Price/Outage/News API)

    • Deploy โ†’ New deployment โ†’ Web app
    • Execute as: Me
    • Who has access: Anyone
  2. Trust Score Project (Trust Score API)

    • Same process, separate deployment

๐Ÿ“ก API Endpoints

Main Project

EndpointDescription
?type=rankingSpeed ranking data
?type=stabilityStability scores (7-day)
?action=getPricingLatest price data

Trust Score Project

EndpointDescription
?action=getTrustScoresTrust scores for all VPNs
?action=getIntegratedCombined ranking (speed + price + trust)
?action=getVPNDetail&vpn=NordVPNSingle VPN details
?action=getJurisdictionJurisdiction database

๐Ÿ”‘ Required API Keys

ServicePurposeFree Tier
ScraperAPIPrice scraping (JS rendering)1,000 req/month
Twitter APIAuto-postingFree (with approval)
Claude APITrust Score evaluationPay per token

Estimated Costs

ServiceMonthly UsageCost
ScraperAPI~150 requestsFree
Twitter API~100 tweetsFree
Claude API~15 evaluations~$0.50
Total~$0.50/month

๐Ÿ“Š Data Flow

[Speed Measurement] โ”€โ”€โ–บ ้€Ÿๅบฆใƒ‡ใƒผใ‚ฟ sheet โ”€โ”€โ”
                                          โ”‚
[Price Scraping] โ”€โ”€โ”€โ”€โ–บ VPNๆ–™้‡‘ๅฑฅๆญด sheet โ”€โ”ผโ”€โ”€โ–บ [Engine 8 Report]
                                          โ”‚         โ”‚
[Outage Detection] โ”€โ”€โ–บ VPN้šœๅฎณๆคœ็Ÿฅ sheet โ”€โ”ค         โ”‚
                                          โ”‚         โ–ผ
[News Monitor] โ”€โ”€โ”€โ”€โ”€โ”€โ–บ VPNใƒ‹ใƒฅใƒผใ‚น sheet โ”€โ”˜    PDF Report
                                               
[Trust Score API] โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
[Twitter Bot] โ”€โ”€โ–บ Speed tweets (3x daily)
              โ”€โ”€โ–บ Trust tweets (monthly)
              โ”€โ”€โ–บ Price alerts (on change)
              
[MailPoet] โ”€โ”€โ”€โ”€โ–บ Weekly digest (Monday)

๐Ÿ› Debugging

Test Functions

Each file includes test functions:

// Speed tracker
checkLatestData();
checkStability();

// Price scraping
testAllVPNsPricing();
quickPricingTest();

// Outage detection
testAdvancedOutageDetection();

// News monitor
testNewsMonitor();

// Twitter
testSpeedTweet();
testTrustScoreTweet();

// Trust Score
testSingleVPNEvaluation();
testIntegratedRanking();

// Market Report
testReportGeneration();
testDataCollection();

Common Issues

IssueSolution
"SCRAPERAPI_KEY not set"Add key to Script Properties
"CLAUDE_API_KEY not set"Add key to Script Properties
Twitter 401 errorCheck OAuth credentials
"No data available"Run measurement/scraping first
ScraperAPI 500 errorSite may be blocking; check fallback

๐Ÿ“ Notes

  • Timezone: All times are JST (Asia/Tokyo)
  • Rate Limits: Built-in delays prevent API throttling
  • Fallback Prices: Used when scraping fails
  • Trust Score: Uses Claude Sonnet 4.5 for evaluation
  • Separate Projects: Trust Score runs in its own spreadsheet for isolation

๐Ÿ“„ License

MIT License - See LICENSE for details.