-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadvanced_rules.sh
More file actions
executable file
·46 lines (37 loc) · 1.21 KB
/
Copy pathadvanced_rules.sh
File metadata and controls
executable file
·46 lines (37 loc) · 1.21 KB
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
#!/bin/bash
# Example: Advanced stream rule management
#
# This example shows how to manually manage stream rules
# for more complex filtering scenarios
if [ -z "$BEARER_TOKEN" ]; then
echo "❌ Error: BEARER_TOKEN environment variable is not set"
exit 1
fi
echo "📋 Step 1: List current rules"
./bin/ctw stream rules list
echo ""
echo "➕ Step 2: Add complex rules"
echo ""
# Rule 1: Track tech news with links in English
./bin/ctw stream rules add \
--value "(Apple OR Google OR Microsoft) (announcement OR launch) has:links lang:en -is:retweet" \
--tag "tech-news"
# Rule 2: Monitor AI discussions with images
./bin/ctw stream rules add \
--value "(AI OR \"artificial intelligence\" OR \"machine learning\") has:images lang:en" \
--tag "ai-visuals"
# Rule 3: Track a specific user's tweets
./bin/ctw stream rules add \
--value "from:TwitterDev" \
--tag "twitter-dev"
echo ""
echo "✅ Step 3: Verify rules were added"
./bin/ctw stream rules list
echo ""
echo "🔴 Step 4: Start streaming"
echo "Press Ctrl+C to stop"
echo ""
./bin/ctw stream \
--field "tweet.fields=created_at,author_id,lang,possibly_sensitive" \
--field "expansions=author_id" \
--field "user.fields=username,name"