Compare commits
No commits in common. "08c8e52d7b837a747cb00480e47f94123d7a1912" and "d82fc393d106b3063f90d0fa1b30008c2d31068d" have entirely different histories.
08c8e52d7b
...
d82fc393d1
13
dybr2fedi.sh
13
dybr2fedi.sh
|
@ -29,15 +29,14 @@ get_Lies_pages()
|
|||
|
||||
get_Lies_pages > "$basedir"/response.json
|
||||
|
||||
for i in $(jq '.["data"] | .[].id' "$basedir"/response.json); do
|
||||
for i in $(jj -l -i "$basedir"/response.json 'data.#.id'); do
|
||||
raw_id=$(echo $i | tr -d '"')
|
||||
if [ ! -f $baseblogdir/$raw_id.gmi ]; then
|
||||
entry_json=$(jq ".[\"data\"] | .[] | select(.id==$i)" "$basedir"/response.json)
|
||||
orig=$(echo $i | sed -e 's/"//g; s|^|https://dybr.ru/blog/liesliasau/|g')
|
||||
title=$(echo "$entry_json" | jq -r ".attributes[\"title\"]")
|
||||
published=$(echo "$entry_json" | jq -r ".attributes[\"created-at\"]")
|
||||
tags=$(echo "$entry_json" | jq -r ".attributes[\"tags\"] | .[]" | tr '\n' ',')
|
||||
content=$(echo "$entry_json" | jq -r ".attributes[\"content\"]")
|
||||
title=$(jj -i "$basedir"/response.json "data.#[id=$i].attributes.title")
|
||||
published=$(jq -r ".[] | .[] | select(.id==$i) | .attributes[\"created-at\"]" "$basedir"/response.json)
|
||||
tags=$(jj -l -i "$basedir"/response.json "data.#[id=$i].attributes.tags" | sed -e 's/"//g' | tr '\n' ',')
|
||||
content=$(jj -i "$basedir"/response.json "data.#[id=$i].attributes.content")
|
||||
links_img=$(echo "$content" | pup 'img attr{src}' | sed 's|^|https://dybr.ru|g')
|
||||
plain_content=$(echo "$content" | w3m -T text/html -cols 65535 -dump -o display_link_number=1 | sed -e 's|\[MORE=.*\]||g ; s|\[/MORE\]||g ; s|\[S:|~~|g ; s|:S\]|~~|g')
|
||||
# Unpack inline images...
|
||||
|
@ -47,7 +46,7 @@ for i in $(jq '.["data"] | .[].id' "$basedir"/response.json); do
|
|||
while [ $index -le $pseudo_index ]; do
|
||||
placeholder=$(echo "$placeholders_img" | sed $index!d | tr -d '[]')
|
||||
img=$(echo "$links_img" | sed $index!d)
|
||||
plain_content=$(echo "$plain_content" | sed "s|\[$placeholder\]|=> $img\n|g")
|
||||
plain_content=$(echo "$plain_content" | sed "s|\[$placeholder\]|=> $img |g")
|
||||
index=$(expr $index + 1)
|
||||
done
|
||||
echo "# $title\n$plain_content\n\ntags: $tags\n=> $orig orig" > $baseblogdir/$raw_id.gmi
|
||||
|
|
Loading…
Reference in New Issue