File size: 1,494 Bytes
d15f07c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Update All LocalView Data Sources
#
# Runs all LocalView scraper scripts to update the dataset

set -e

echo "๐Ÿ›๏ธ  LocalView Data Update Pipeline"
echo "===================================="
echo ""

cd "$(dirname "$0")/../.."

# Activate virtual environment
if [ -f .venv/bin/activate ]; then
    source .venv/bin/activate
elif [ -f venv/bin/activate ]; then
    source venv/bin/activate
fi

# Check for API key
if [ -z "$YOUTUBE_API_KEY" ]; then
    echo "โš ๏ธ  YOUTUBE_API_KEY not set"
    echo ""
    echo "Add to .env file:"
    echo "  YOUTUBE_API_KEY=your_api_key_here"
    echo ""
    echo "Get an API key at: https://console.cloud.google.com/apis/credentials"
    exit 1
fi

echo "โœ… YouTube API key found"
echo ""

# Step 1: Scrape YouTube channels
echo "๐Ÿ“น Step 1: Scraping YouTube channels..."
python scripts/localview/scrape_youtube_channels.py --update --since-days 60

# Step 2: Extract transcripts
echo ""
echo "๐Ÿ“ Step 2: Extracting transcripts..."
python scripts/localview/extract_transcripts.py --year $(date +%Y)

# Step 3: Load into database
echo ""
echo "๐Ÿ’พ Step 3: Loading into database..."
if [ -f discovery/localview_ingestion.py ]; then
    python discovery/localview_ingestion.py
else
    echo "โš ๏ธ  Ingestion script not found, skipping database load"
fi

echo ""
echo "โœ… LocalView update complete!"
echo ""
echo "Data saved to:"
echo "  - data/cache/localview/videos_$(date +%Y).csv"
echo "  - data/cache/localview/transcripts/*.txt"