Twitter working!

master
Steven Saus 4 years ago
parent fd30f63478
commit 8893106160
  1. 5
      README.md
  2. 12
      out_avail/oysttyer.sh
  3. 15
      out_avail/toot.sh
  4. 21
      out_avail/twython.sh
  5. 1
      out_enabled/toot.sh
  6. 2
      tweet.py

@ -76,6 +76,7 @@ virtualenv henceforth.
* `sudo chmod +x $PWD/agaetr_parse.py`
* `sudo chmod +x $PWD/agaetr_send.sh`
* (If using `tweet.py`) `sudo chmod +x $PWD/tweet.py`
* `pip install -U twython --user`
* `pip install -U appdirs`
* `pip install -U configparser`
* `pip install -U beautifulsoup4`
@ -150,6 +151,10 @@ You must register a [Twitter application](https://apps.twitter.com) and get
Place the location of the binary into `agaetr.ini`.
*Optional* - Put the full path to the virtual environment's python interpreter
in for the shebang for `tweet.py`, as in: `#!/path/to/home/agaeter_venv/bin/python` . I had no luck with this;
I ended up having to install it globally.
APP_KEY = ""
APP_SECRET = ""
OAUTH_TOKEN = ""

@ -3,19 +3,19 @@
function oysttyer_send {
binary=$(grep 'oysttyer =' "$HOME/.config/agaetr/agaetr.ini" | sed 's/ //g' | awk -F '=' '{print $2}')
outstring = printf "From %s: %s - %s %s %s" "$pubtime" "$title" "$description" "$link" "$hashtags"
outstring=$(printf "From %s: %s - %s %s %s" "$pubtime" "$title" "$description" "$link" "$hashtags")
if [ ${#outstring} -gt 280 ]; then
outstring = printf "From %s: %s - %s %s" "$pubtime" "$title" "$description" "$link"
outstring=$(printf "From %s: %s - %s %s" "$pubtime" "$title" "$description" "$link")
if [ ${#outstring} -gt 280 ]; then
outstring = printf "%s - %s %s %s" "$title" "$description" "$link"
outstring=$(printf "%s - %s %s %s" "$title" "$description" "$link")
if [ ${#outstring} -gt 280 ]; then
outstring = printf "From %s: %s %s " "$pubtime" "$title" "$link"
outstring=$(printf "From %s: %s %s " "$pubtime" "$title" "$link")
if [ ${#outstring} -gt 280 ]; then
outstring = printf "%s %s" "$title" "$link"
outstring=$(printf "%s %s" "$title" "$link" )
if [ ${#outstring} -gt 280 ]; then
short_title=`echo "$title" | awk '{print substr($0,1,110)}'`
outstring = printf "%s %s" "$short_title" "$link"
outstring=$(printf "%s %s" "$short_title" "$link" )
fi
fi
fi

@ -9,29 +9,27 @@ function toot_send {
#reusing code here.
if [ ${#outstring} -gt 500 ]; then
outstring = printf "From %s: %s - %s %s" "$pubtime" "$title" "$description" "$link"
outstring=$(printf "From %s: %s - %s %s" "$pubtime" "$title" "$description" "$link")
if [ ${#outstring} -gt 500 ]; then
outstring = printf "%s - %s %s %s" "$title" "$description" "$link"
outstring=$(printf "%s - %s %s %s" "$title" "$description" "$link")
if [ ${#outstring} -gt 500 ]; then
outstring = printf "From %s: %s %s " "$pubtime" "$title" "$link"
outstring=$(printf "From %s: %s %s " "$pubtime" "$title" "$link")
if [ ${#outstring} -gt 500 ]; then
outstring = printf "%s %s" "$title" "$link"
outstring=$(printf "%s %s" "$title" "$link")
if [ ${#outstring} -gt 500 ]; then
short_title=`echo "$title" | awk '{print substr($0,1,110)}'`
outstring = printf "%s %s" "$short_title" "$link"
outstring=$(printf "%s %s" "$short_title" "$link")
fi
fi
fi
fi
fi
echo "!!!!!!!!!! $imgurl"
# Get the image, if exists, then send the tweet
if [ ! -z "$imgurl" ];then
Outfile=$(mktemp)
urlstring=$(echo "$imgurl -o $Outfile --max-time 60 --create-dirs -s")
curl "$imgurl" -o "$Outfile" --max-time 60 --create-dirs -s
echo "Image obtained, resizing."
#resize to twitter's size if available
@ -56,7 +54,6 @@ function toot_send {
fi
postme=$(printf "%s post \"%s\" %s %s --quiet" "$binary" "$outstring" "$imgurl" "$cw")
echo "$postme"
eval ${postme}

@ -3,19 +3,19 @@
function twython_send {
binary=$(grep 'twython =' "$HOME/.config/agaetr/agaetr.ini" | sed 's/ //g' | awk -F '=' '{print $2}')
outstring = printf "From %s: %s - %s %s %s" "$pubtime" "$title" "$description" "$link" "$hashtags"
outstring=$(printf "From %s: %s - %s %s %s" "$pubtime" "$title" "$description" "$link" "$hashtags")
if [ ${#outstring} -gt 280 ]; then
outstring = printf "From %s: %s - %s %s" "$pubtime" "$title" "$description" "$link"
outstring=$(printf "From %s: %s - %s %s" "$pubtime" "$title" "$description" "$link" )
if [ ${#outstring} -gt 280 ]; then
outstring = printf "%s - %s %s %s" "$title" "$description" "$link"
outstring=$(printf "%s - %s %s %s" "$title" "$description" "$link" )
if [ ${#outstring} -gt 280 ]; then
outstring = printf "From %s: %s %s " "$pubtime" "$title" "$link"
outstring=$(printf "From %s: %s %s " "$pubtime" "$title" "$link")
if [ ${#outstring} -gt 280 ]; then
outstring = printf "%s %s" "$title" "$link"
outstring=$(printf "%s %s" "$title" "$link")
if [ ${#outstring} -gt 280 ]; then
short_title=`echo "$title" | awk '{print substr($0,1,110)}'`
outstring = printf "%s %s" "$short_title" "$link"
outstring=$(printf "%s %s" "$short_title" "$link")
fi
fi
fi
@ -26,18 +26,19 @@ function twython_send {
if [ ! -z "$imgurl" ];then
Outfile=$(mktemp)
urlstring=$(echo "$imgurl -o $Outfile --max-time 60 --create-dirs -s")
curl "$urlstring"
curl "$imgurl" -o "$Outfile" --max-time 60 --create-dirs -s
#resize to twitter's size if available
if [ -f /usr/bin/convert ];then
/usr/bin/convert -resize 800x512\! "$Outfile" "$Outfile"
fi
imgurl=$(echo "--file $Outfile")
imgurl=$(echo "-f $Outfile")
else
imgurl=""
fi
postme = printf "%s --message %s %s" "$binary" "$outstring" "$imgurl"
postme=$(printf "%s -t \"%s\" %s" "$binary" "$outstring" "$imgurl")
echo "$postme"
read
eval ${postme}
if [ -f "$Outfile" ];then

@ -1 +0,0 @@
/home/steven/documents/programming/agaetr/out_avail/toot.sh

@ -48,7 +48,7 @@ media_fn = args.media_fn
if media_fn is not None:
mfiles = media_fn.split()
mfiles = media_fn[0].split()
lm = len(mfiles)
mfid = []
for i in range(lm):

Loading…
Cancel
Save