-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathscript.sh
More file actions
82 lines (66 loc) · 3.03 KB
/
Copy pathscript.sh
File metadata and controls
82 lines (66 loc) · 3.03 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
################################################################################
# Description: Replaces Instagram feed endpoints
# Author: breakthescroll.com
################################################################################
# Get the script name
script_name=$(basename "$0")
# Directory of the decompiled app
target_directory="."
# Define the replacements
declare -A replacements
###############################################################################
########### Uncomment / Comment to Add / Remove resources endpoints ###########
###############################################################################
replacements["\"discover/topical_explore/\""]="\"\""
### Feed main screen
replacements["feed/timeline/\""]="\""
### Feed stories (CAN still upload stories)
# replacements["\"feed/reels_tray/\""]="\"\""
### Reels
replacements["\"clips/discover/\""]="\"\""
# clips/discover/social removes reels liked by friends
replacements["\"clips/discover/social/\""]="\"\""
replacements["\"discover/explore_clips/\""]="\"\""
replacements["\"clips/discover/stream/\""]="\"\""
#replacements["\"clips/\""]="\"\""
replacements["\"clips/suggested_template\""]="\"\""
replacements["\"clips/trend/\""]="\"\""
#replacements["\"clips/items/\""]="\"\""
replacements["\"discover/discover_similar_clips/\""]="\"\""
replacements["\"/suggested_content/\""]="\"\""
#replacements["\"clips/item/\""]="\"\""
replacements["\"clips/home/\""]="\"\""
replacements["\"clips/chaining/\""]="\"\""
replacements["\"clips/recommended_label/\""]="\"\""
#replacements["\"clips/stream_clips_pivot_page/\""]="\"\""
#replacements["\"clips/risu_medias/\""]="\"\""
#replacements["\"clips_media_ids\""]="\"\""
#replacements["\"/clips\""]="\"\""
replacements["\"/clips_media_feed/\""]="\"\""
###############################################################################
###############################################################################
###############################################################################
echo "Breaking endpoints... This can take a few minutes"
# Collect files (excluding this script and .apk files)
mapfile -t files < <(find "$target_directory" -type f ! -name "$script_name" ! -name "*.apk")
file_count=${#files[@]}
# Create a temporary sed script file to store all replacements (batch processing)
sed_script=$(mktemp)
for old in "${!replacements[@]}"; do
new="${replacements[$old]}"
echo "s|$old|$new|g" >> "$sed_script"
done
# Check if tqdm is installed for progress tracking
if command -v tqdm &> /dev/null; then
echo "Processing $file_count files with tqdm progress..."
# Use tqdm for progress and xargs for parallel execution
printf "%s\n" "${files[@]}" | tqdm --total=$file_count --desc "Replacing Endpoints" | xargs -I {} sed -i -f "$sed_script" "{}"
else
echo "tqdm not installed. Running without progress bar."
# Process files without tqdm
xargs -a <(printf "%s\n" "${files[@]}") -I {} sed -i -f "$sed_script" "{}"
fi
# Clean up temporary sed script
rm "$sed_script"
echo "Success: Endpoints broken!"