-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrawler.sh
More file actions
executable file
·28 lines (23 loc) · 811 Bytes
/
Copy pathcrawler.sh
File metadata and controls
executable file
·28 lines (23 loc) · 811 Bytes
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
#!/bin/bash
# A shell script for our python reddit crawler.
# Check for our required arguments.
if [ $# -ne 4 ]; then
echo "Usage: $0 <subreddits-file> <keywords-file> <output_dir> <target_size_mb>"
exit 1
fi
# Assign arguments to variables.
SUBREDDITS_FILE=$1
KEYWORDS_FILE=$2
OUTPUT_DIR=$3
TARGET_SIZE_MB=$4
# Create the output directory if it doesn't exist.
mkdir -p "$OUTPUT_DIR"
# Check if the output directory was created successfully.
if [ $? -ne 0 ]; then
echo "Error: Could not create output directory $OUTPUT_DIR"
exit 1
fi
# Run the Python script with the provided arguments.
python3 reddit_crawler.py "$SUBREDDITS_FILE" "$KEYWORDS_FILE" "$OUTPUT_DIR" "$TARGET_SIZE_MB"
# Output a message indicating the script has finished.
echo "Crawling completed. Data saved to $OUTPUT_DIR."