Compare commits

...

3 commits

View file

@ -151,14 +151,14 @@ follow_api_export()
echo "$acc_following_count followings exported"
elif [ $count -lt 40 ]; then
countindex=$(expr $count - 1)
echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv
echo $followings | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/friends.csv
offset=$(echo $followings | jj $countindex.id)
echo "+$count follows"
count=0
echo "$acc_following_count followings exported"
elif [ $count -gt 0 ]; then
countindex=$(expr $count - 1)
echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv
echo $followings | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/friends.csv
offset=$(echo $followings | jj $countindex.id)
echo "+$count follows"
fi
@ -177,13 +177,13 @@ blocks_api_export()
echo "Blocks exported"
elif [ $count -lt 40 ]; then
countindex=$(expr $count - 1)
echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv
echo $blocks | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/blocks.csv
offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks"
count=0
echo "Blocks exported"
elif [ $count -gt 0 ]; then
echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv
echo $blocks | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/blocks.csv
offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks"
fi
@ -202,13 +202,13 @@ mutes_api_export()
echo "Mutes exported"
elif [ $count -lt 40 ]; then
countindex=$(expr $count - 1)
echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv
echo $mutes | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/mutes.csv
offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes"
count=0
echo "Mutes exported"
elif [ $count -gt 0 ]; then
echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv
echo $mutes | jj -l \#.acct | delq| legacy_addr_preprocess >> backups_$instance/mutes.csv
offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes"
fi
@ -260,6 +260,21 @@ thread_api_statuses()
default_curl_opt "$instance_point/statuses/$1/context"
}
html_to_txt_render()
{
sed -e "s/<br[^>]*>/\n/g ; s/<p[^>]*>/\n/g ; s/<[^>]*>//g ; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/\"/g ; s/&#39;/'/g"
}
delq()
{
sed 's/"//g'
}
delqse()
{
sed 's/^"//g; s/"$//g'
}
thread_menu()
{
sub_menu_lvl=2
@ -288,10 +303,8 @@ thread_menu()
if [ -n "$reply_to_id" ]; then
echo "Reply to: $reply_to_id"
fi
echo $status | jj content | sed -e "s/<br[^>]*>/\n/g
; s/<p[^>]*>/\n/g ; s/<[^>]*>//g
; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/\"/g ; s/&#39;/'/g"
attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g')
echo "$status" | jj -r content | delqse | html_to_txt_render
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
if [ -n "$attachments" ]; then
echo "#EXTINF:-1, $uri" >> attachments.m3u8
echo "$attachments" >> attachments.m3u8
@ -321,7 +334,7 @@ timeline_menu()
while [ $sub_menu_lvl -eq 1 ]; do
while [ $indexator -gt 0 ]; do
status=$(echo $json | jj $indexator)
status=$(echo "$json" | jj $indexator)
reblog=$(echo $status | jj reblog)
uri=$(echo $status | jj uri)
id_status=$(echo $status | jj id)
@ -334,9 +347,11 @@ timeline_menu()
if [ -n "$reblog" ]; then
echo "$boost_symbol"
fi
echo $status | jj content | sed -e "s/<br[^>]*>/\n/g
; s/<p[^>]*>/\n/g ; s/<[^>]*>//g
; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/\"/g ; s/&#39;/'/g"
spoiler_text=$(echo "$status" | jj spoiler_text)
if [ -n "$spoiler_text" ]; then
echo "#[$spoiler_text]"
fi
echo "$status" | jj -r content | delqse | html_to_txt_render
attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g')
if [ -n "$attachments" ]; then
echo "#EXTINF:-1, $uri" >> attachments.m3u8
@ -345,13 +360,13 @@ timeline_menu()
indexator=$(expr $indexator - 1)
echo '_____'
done
menu=$(echo 'Prev\nNext\nReply\nShare\nThread\nMain menu' | fzy)
menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nMain menu' | fzy)
case $menu in
"Prev")
indexator=$(expr $max_statuses - 1)
echo '#EXTM3U' > attachments.m3u8
clear
offset=$(jj -i preload 39.id)
offset=$(jj -i preload $indexator.id)
json=$(timeline_api $offset)
;;
"Next")
@ -380,6 +395,19 @@ timeline_menu()
fi
done
;;
"Favorite")
echo 'Input id (s - stop)'
favoritemode=1
while [ $favoritemode -eq 1 ]; do
read status_id
if [ "$status_id" = 's' ]; then
favoritemode=0
else
favorite_api_status $status_id
echo $http_code
fi
done
;;
"Thread")
indexator=$(expr $max_statuses - 1)
echo 'Input id'
@ -398,6 +426,11 @@ share_api_status()
post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null
}
favorite_api_status()
{
post_request -w "%{http_code}" --url $instance_point/statuses/$1/favourite --output /dev/null
}
write_api_status()
{
if [ -n "$mediaattach" ]; then