shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] Usando zenity para postar msg no Twitter


From: Anderson Duarte
Subject: Re: [shell-script] Usando zenity para postar msg no Twitter
Date: Fri, 22 Jan 2010 20:33:12 -0300
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

O Script ficou legal, mas eu vou te dar uma dica pra melhorar.
Use o wc para contar quantos caracteres o usuario escreveu antes de
enviar o "Tweet" pois lembre-se que o Twitter  limita-se em 140
caracteres.
Vc pode fazer algo assim:

anderson@Netbook:~$ post=blablablablablablabla
anderson@Netbook:~$ echo $post | wc -c
22

Se tiver igual ou menos que 140 envia, se não, pede para diminuir o
post. :P
Vc ainda pode (se quiser) usar tb o proprio Curl com o Sed pra pegar
links grandes e diminuir em algum serviço tipo um tinyurl da vida...
Eu tb fiz um tweetscript que fica agendado em meu cron pra a partir de
um arquivo de frases, ele sorteia uma e manda automaticamente! ;)

Boa sorte.



Leonardo Abreu escreveu:
>
>
> Pessoal,
>
> Entrei para a lista por incentivo do Julio Neves depois do curso de
>  shellscript que fiz com ele, aqui no Rio. Tenho acompanhado todos
> os assuntos que por aqui passam e vejo o excelente nível dos
> profissionais que aqui participam e as mais variadas soluções
> propostas para um mesmo tipo problema, o que tem me ensinado
> bastante.
>
> Minha humilde contribuição de um script que fiz usando zenity para
> postar mensagens no Twitter:
>
> ============== Início =================
>
> # Postar no Twitter via terminal usando zenity. # Script
> desenvolvido por Leonardo Abreu >> twitter.com/@leonardosabreu #
> Data: 22/01/2010 # Versão: 0.1
>
> # Armazena nome do usuario no Twitter: login=$(zenity --entry
> --text "Twitter: Insira seu login:")
>
> # Armazena a senha ocultando seu conteudo: pass=$(zenity --entry
> --hide-text --text "Twitter: Informe sua senha:")
>
> # Armazena a mensagem a ser enviada ao Twitter: post=$(zenity
> --entry --text "Twitter: Digite sua mensagem em 140 caracteres:")
>
> # Faz o login no twitter e posta a mensagem digitada. curl -u
> $login:$pass -d status="$post"
> http://twitter.com/statuses/update.xml
> <http://twitter.com/statuses/update.xml> &> \ /dev/null
>
> ============== FIM ================
>
> Obs.: Moderador, as dúvidas sobre scripts usando zenity e suas
> aplicações podem ser discutidas aqui? Caso negativo, desde já peço
> desculpas pela mensagem.
>
> -- Leonardo Abreu. http://twitter.com/leonardosabreu
> <http://twitter.com/leonardosabreu>
> ----------------------------------------------- Você já plantou uma
> árvore hoje? http://projetoremoma.org <http://projetoremoma.org>
> -----------------------------------------------
>
>  <!-- #ygrp-mkp { border: 1px solid #d8d8d8; font-family:
> Arial; margin: 10px 0; padding: 0 10px; } #ygrp-mkp hr { border:
> 1px solid #d8d8d8; } #ygrp-mkp #hd { color: #628c2a; font-size:
> 85%; font-weight: 700; line-height: 122%; margin: 10px 0; }
> #ygrp-mkp #ads { margin-bottom: 10px; } #ygrp-mkp .ad { padding: 0
> 0; } #ygrp-mkp .ad a { color: #0000ff; text-decoration: none; }
> #ygrp-sponsor #ygrp-lc { font-family: Arial; } #ygrp-sponsor
> #ygrp-lc #hd { margin: 10px 0px; font-weight: 700; font-size: 78%;
> line-height: 122%; } #ygrp-sponsor #ygrp-lc .ad { margin-bottom:
> 10px; padding: 0 0; } a { color: #1e66ae; } #actions { font-family:
>  Verdana; font-size: 11px; padding: 10px 0; } #activity {
> background-color: #e0ecee; float: left; font-family: Verdana;
> font-size: 10px; padding: 10px; } #activity span { font-weight:
> 700; } #activity span:first-child { text-transform: uppercase; }
> #activity span a { color: #5085b6; text-decoration: none; }
> #activity span span { color: #ff7900; } #activity span .underline {
>  text-decoration: underline; } .attach { clear: both; display:
> table; font-family: Arial; font-size: 12px; padding: 10px 0; width:
> 400px; } .attach div a { text-decoration: none; } .attach img {
> border: none; padding-right: 5px; } .attach label { display: block;
>  margin-bottom: 5px; } .attach label a { text-decoration: none; }
> blockquote { margin: 0 0 0 4px; } .bold { font-family: Arial;
> font-size: 13px; font-weight: 700; } .bold a { text-decoration:
> none; } dd.last p a { font-family: Verdana; font-weight: 700; }
> dd.last p span { margin-right: 10px; font-family: Verdana;
> font-weight: 700; } dd.last p span.yshortcuts { margin-right: 0; }
> div.attach-table div div a { text-decoration: none; }
> div.attach-table { width: 400px; } div.file-title a, div.file-title
>  a:active, div.file-title a:hover, div.file-title a:visited {
> text-decoration: none; } div.photo-title a, div.photo-title
> a:active, div.photo-title a:hover, div.photo-title a:visited {
> text-decoration: none; } div#ygrp-mlmsg #ygrp-msg p a
> span.yshortcuts { font-family: Verdana; font-size: 10px;
> font-weight: normal; } .green { color: #628c2a; } .MsoNormal {
> margin: 0 0 0 0; } o { font-size: 0; } #photos div { float: left;
> width: 72px; } #photos div div { border: 1px solid #666666; height:
>  62px; overflow: hidden; width: 62px; } #photos div label { color:
> #666666; font-size: 10px; overflow: hidden; text-align: center;
> white-space: nowrap; width: 64px; } #reco-category { font-size:
> 77%; } #reco-desc { font-size: 77%; } .replbq { margin: 4px; }
> #ygrp-actbar div a:first-child { /* border-right: 0px solid #000;*/
>  margin-right: 2px; padding-right: 5px; } #ygrp-mlmsg { font-size:
> 13px; font-family: Arial, helvetica,clean, sans-serif; *font-size:
> small; *font: x-small; } #ygrp-mlmsg table { font-size: inherit;
> font: 100%; } #ygrp-mlmsg select, input, textarea { font: 99%
> Arial, Helvetica, clean, sans-serif; } #ygrp-mlmsg pre, code {
> font:115% monospace; *font-size:100%; } #ygrp-mlmsg * {
> line-height: 1.22em; } #ygrp-mlmsg #logo { padding-bottom: 10px; }
> #ygrp-mlmsg a { color: #1E66AE; } #ygrp-msg p a { font-family:
> Verdana; } #ygrp-msg p#attach-count span { color: #1E66AE;
> font-weight: 700; } #ygrp-reco #reco-head { color: #ff7900;
> font-weight: 700; } #ygrp-reco { margin-bottom: 20px; padding: 0px;
> } #ygrp-sponsor #ov li a { font-size: 130%; text-decoration: none;
> } #ygrp-sponsor #ov li { font-size: 77%; list-style-type: square;
> padding: 6px 0; } #ygrp-sponsor #ov ul { margin: 0; padding: 0 0 0
> 8px; } #ygrp-text { font-family: Georgia; } #ygrp-text p { margin:
> 0 0 1em 0; } #ygrp-text tt { font-size: 120%; } #ygrp-vital ul
> li:last-child { border-right: none !important; } -->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEcBAEBAgAGBQJLWjW3AAoJEFifSKRkExpABZ4H/090w2hxGB77FfpAvpnurhS2
LM2IKMg90e2I5ZLuzWEHUm4vvBOiU73D7p3Z225vGvpf8ez4CagDm8PPhYMrLgiM
ECRtpEWG+iWrCNOlkrzpAN4ESvAWcsf9nTt7NVQ8EWZIfPmWYGq9tywspz0dp1/6
gAYgOn6L/pLh4Bv4teokpmX6/9jdEIHx4FLBFPNFkUON2u1DXWctUMEsnu6erGOk
WH141IxxVVMQDjzopfDQd4HFEhIsaSf8rxJ5fnIJfFLNYhvS27vNII/ViLhVJ+Dt
OgHdIdLNca6LHz1I0HkEZkjIvuAUhYcc+xb6bXYV02xgFg51Z0XAdwtfm2PgBxc=
=PjqD
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]