*Mu and seaside had the idea for this and seaside used gtkdialog *
http://www.murga-linux.com/puppy/viewto ... 1975402649
I wanted to do the same thing but I prefer Xdialog
and I wanted to test the three input option so I rewrote the GUI part in Xdialog
Major update
Updated and modified a lot to be easier for big threads
it makes a folder dates it , renames and renumbers the files
so that its easier on the browser to scroll quickly
12-29-2011
added long names and a filter to clean poorly formatted names
with the end goal from here files could be read and edited quickly
you can filter out the unneeded posts
Code: Select all
#!/bin/sh
# thread_saver big_bass completely rewritten to the basics and using Xdialog
# 12-29-2011
# added date to folder rewritten the download part and the naming
# of the files and numbering
# original idea was based on
# ThreadGet Seaside 11-24-2010 (Based on Mu's Fetchforum basic program)
# For use on phpBB forums
# update 3-29-2011 --add startpage, append to existing files
#------------------------------------------------
SEL=`Xdialog \
--title "thread_saver" \
--separator "\n" --stdout \
--3inputsbox "thread_saver" 0 0 \
"URL (dowload this link)" "$1" \
"end page number" "$2" \
"name the html file" "$3"`
# lets get the three values in 3 separate arrays
SEL_ARRARY=($SEL)
THREAD=${SEL_ARRARY[0]}
NPAGE=${SEL_ARRARY[1]}
NAME=${SEL_ARRARY[@]:2:20}
# NAME get long names start at the third string
# and count 20 words as the max length
# rename badly formatted files that have spaces and symbols
NAME_FIXED=`echo "$NAME" | tr ';"<>,+!@#$?%^*&(){}[]' ' ' | tr -s ' ' '_*'`
#------------------------------------------------
add_date=`date "+%m"-"%d"-"%y"`
URL_NAME=`basename $THREAD`
mkdir -p /root/Forum_Threads/${NAME_FIXED}"-folder-"${add_date}
cd /root/Forum_Threads/${NAME_FIXED}"-folder-"${add_date}
# zero start count fix
NPAGE=($NPAGE-1)
let ALL_POSTS=15*$NPAGE
# simplified the renaming renumbering code a lot big_bass
for i in $(seq 0 15 $ALL_POSTS); do
let N_ADJ=($i/15)
wget -N "$THREAD&start=$i"
mv "$URL_NAME&start=$i" "${NAME_FIXED}""_""$N_ADJ"
echo "$URL_NAME&start=$i" "${NAME_FIXED}""_""$N_ADJ"
done
Xdialog --title "done" \
--msgbox "Thread downloaded to /root/Forum_Threads " 0 0 3000