aboutsummaryrefslogtreecommitdiff
path: root/subprojects/freeamo/src/unmaintained/bad_names
blob: 6ba88912378fea86cc18b50bd27f77aa083956ba (plain) (blame)
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
function search-pages--filter__bad_names() {

name=$(jq .results[$entry].name "$run_path/build/json/$file" | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;");

if [ "$name" == "null" ]; then

name=$(jq .results[$entry].name "$run_path/build/json/$file" | sed "s|en-GB|enGB|;" | jq .enGB | sed "s|^\"||; s|\"$||;");

fi

# The API `name` parameter makes bad MediaWiki URL's - https://github.com/mozilla/addons-server/issues/8790
# Clean titles. Example of bad titles: "Ghostery – Privacy Ad Blocker"

# -
# Hard to filter out "-" since many add-ons use it, see for example https://addons.mozilla.org/en-US/firefox/search/?platform=linux&q=1-click
# Flash Video Downloader - YouTube HD Download [4K]

# Find all names that don't contain Aa-Zz 0-9 and white spaces should be much more reliable than this:
name=$(echo "$name" | sed '
s/ — /\n/g;
s/ – /\n/g;
s/ - /\n/g; # looks identical to the prevoius line but is unique
s/: /\n/g;
s/(/\n/g;
s/,/\n/g;
s/™/\n/g;
' | head -n 1 | sed 's/ $//');

}