Fetch formatted wiki text instead of raw wiki markup
This commit is contained in:
parent
88feb87009
commit
2678fe5505
@ -1,6 +1,6 @@
|
|||||||
fetch_category () {
|
fetch_category () {
|
||||||
echo "Fetching $1" > /dev/stderr
|
echo "Fetching $1" > /dev/stderr
|
||||||
json=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=query&format=json&list=categorymembers&cmtitle=Category:$1&cmlimit=1000" 2>/dev/null`
|
json=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=query&format=json&list=categorymembers&cmtitle=Category:$1&cmlimit=max" 2>/dev/null`
|
||||||
cities=`echo "$json" | json_reformat | sed -n 's/.*"title":\s*"\([^"]*\).*/\1/p' | tr ' ' '_' | tr '\n' ' '`
|
cities=`echo "$json" | json_reformat | sed -n 's/.*"title":\s*"\([^"]*\).*/\1/p' | tr ' ' '_' | tr '\n' ' '`
|
||||||
num=`echo $cities | tr ' ' '\n' | wc -l`
|
num=`echo $cities | tr ' ' '\n' | wc -l`
|
||||||
i=0
|
i=0
|
||||||
|
@ -11,8 +11,8 @@ coords=`echo "$json" | sed -n "s/.*coordinates = {{Co|\([^}]*\).*/\1/p"`
|
|||||||
coord_x=`echo "$coords" | sed -n "s/\([^|]\+\).*/\1/p"`
|
coord_x=`echo "$coords" | sed -n "s/\([^|]\+\).*/\1/p"`
|
||||||
coord_y=`echo "$coords" | sed -n "s/.*|\([^|]\+\).*/\1/p"`
|
coord_y=`echo "$coords" | sed -n "s/.*|\([^|]\+\).*/\1/p"`
|
||||||
|
|
||||||
description=`echo $json | sed -n "s/.*coordinates.*[^']*'''\([^']*\)'''\([^\.]*\).*/\1\2./p"
|
description=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=parse&page=$1§ion=0&prop=text&format=json" 2>/dev/null | sed -z -n "s/<\/p><p>//g;s/.*<p>\(.*\)<\/p>.*/\1/p"`
|
||||||
`
|
|
||||||
|
|
||||||
if [[ "$coord_x" != "" && "$coord_y" != "" ]]; then
|
if [[ "$coord_x" != "" && "$coord_y" != "" ]]; then
|
||||||
echo "{\
|
echo "{\
|
||||||
|
Loading…
Reference in New Issue
Block a user