Announcement

Collapse
No announcement yet.

Using wget to send to Twitter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    IKUS

    Not quite sure I follow you (sorry for being so slow). What would the format of the vbscript for a direct message be exactly?

    Also would appreciate a beginners intro on curl. Would this be a better route than wget?

    Thanks for the help.
    Regards, Bob

    Comment


      #17
      Originally posted by itanic View Post
      IKUS

      Not quite sure I follow you (sorry for being so slow). What would the format of the vbscript for a direct message be exactly?

      Also would appreciate a beginners intro on curl. Would this be a better route than wget?

      Thanks for the help.
      I have to take back my previous statement about using the the d recipient message syntax to direct message via curl or wget. It turns out that it isn't this simple because you need to already be logged on AND following each other before you can use the direct message functionality. I haven't played with this yet but I'll check it out maybe this weekend and post here...unless of course someone else is already doing this and can share.

      As for cURL, it's very similar. I personally prefer cURL because it doesn't send it's output to a file. Since you're already familiar with wget, here is a wget example followed by the curl equivalent:

      wget example:
      wget --keep-session-cookies --http-user=user_id --http-password=password --post-data=status="message" http://twitter.com:80/statuses/update.xml

      curl equivalent:
      curl --basic --user=user_idassword --data status="message" http://twitter.com/statuses/update.xml

      That emoticon above is a colon followed by a lower-case p.

      Comment


        #18
        Originally posted by IKUS View Post
        I have to take back my previous statement about using the the d recipient message syntax to direct message via curl or wget. It turns out that it isn't this simple because you need to already be logged on AND following each other before you can use the direct message functionality. I haven't played with this yet but I'll check it out maybe this weekend and post here...unless of course someone else is already doing this and can share.
        IKUS,

        Any luck getting this to work for direct tweets? I've been using twitter for sending homeseer notifications to family and friends, but would really like to supplement this with direct tweets.
        Regards, Bob

        Comment


          #19
          hey there,

          sorry i haven't logged on in a while. just looked at the twitter API as documented on their site and there is an easy way to do this now. I've verified that it works. Just remember that the recipient of the direct message has to be following the sender.

          using curl:

          curl --user sending_user_idassword --data "text=direct message text&user=receiving_user_id" --insecure https://twitter.com/direct_messages/new.xml

          as before the emoticon above is supposed to be a colon followed by a "p"
          Last edited by IKUS; June 27, 2009, 04:26 PM.

          Comment


            #20
            Given your script below, how would one pass a status variable/text to this ? Could have a generic script.

            Originally posted by IKUS View Post
            hey there,

            sorry i haven't logged on in a while. just looked at the twitter API as documented on their site and there is an easy way to do this now. I've verified that it works. Just remember that the recipient of the direct message has to be following the sender.

            using curl:

            curl --user sending_user_idassword --data "text=direct message text&receiving_user_id" --insecure https://twitter.com/direct_messages/new.xml

            as before the emoticon above is supposed to be a colon followed by a "p"

            Comment


              #21
              You can put it in a script with the message text as a variable... here's an example using javascript:

              put the following into a script file with a .js extension:

              function tweet(strInput)
              {
              hs.launch("C:/Program Files/curl/bin/curl.exe","--basic --user sending_user_idassword --data \"text=" + strInput + "&user=receiving_user_id"\ --insecure https://twitter.com/direct_messages/new.xml");
              }

              then you would have an hs event that references this "Existing script" .js file with the optional parameters ("tweet","This is the text I want to direct message via twitter")

              Of course, you could get fancier and have the script take more parameters so that you could dynamically pass the user id and password of the sending user and/or the user id of the receiving user...but if these will remain static then this script should suffice as it will let you dynamically change the tweet text on each call.
              Last edited by IKUS; June 27, 2009, 04:26 PM.

              Comment


                #22
                This is a great use for Twitter, could someone put a sample script up as I keep getting compile errors in the HS log. I have managed to get Wget kind of working but have been out of practise with scripting for too long.

                Thanks
                Wher2guv

                Comment


                  #23
                  I don't twitter so i can't test this, but a quick google search turned up the below. I assume the desired action is to post a twit(?) to an account without actually logging into the account. Maybe somebody with an account can try using the below http to send themselves a message. If this actually works, then the rest would be easy.

                  edit: on the end of the below one needs to add after the create/ their twitter username. the < twitter username > doesn't show in the forum post.

                  http://twitter.com/your_direct_message/create/<twitter username>
                  Why I like my 2005 rio yellow Honda S2000 with the top down, and more!

                  Comment


                    #24
                    The last post in this thread is not right. You can't tweet without logging in. For examples of wget usage see #17 in this thread. for a script example see #21 in this thread.

                    Comment


                      #25
                      IKUS

                      I'm still having problems with the direct messages. I got a general post to work using wget and the following format.

                      Sub tweet(sMessage)

                      sMessage = sMessage& " ("&NewTime&")"
                      hs.launch "C:\Program Files\GnuWin32\bin\wget.exe","--keep-session-cookies --quiet --http-user=USERID --http-password=PASSWORD --post-data=status="&chr(34)&sMessage&chr(34)&" http://twitter.com:80/statuses/update.xml"

                      End Sub

                      But I can't seem to figure out the format of the direct message (using a varialbe like I do above) using wget. Any help would be appreciated.
                      Regards, Bob

                      Comment


                        #26
                        could somebody wrap this up into a plugin?

                        Comment


                          #27
                          Originally posted by Jakob.Sand View Post
                          could somebody wrap this up into a plugin?
                          I agree. Twitter is great.
                          Regards, Bob

                          Comment


                            #28
                            Originally posted by itanic View Post
                            Making some progress on this. I can now send tweets to my twitter account using the following script.

                            Sub tweet(sMessage)

                            sMessage = sMessage& " ("&NewTime&")"

                            hs.launch "C:\Program Files\GnuWin32\bin\wget.exe","--keep-session-cookies --quiet --http-user=USERNAME --http-password=PASSWORD --post-data=status="&chr(34)&sMessage&chr(34)&" http://twitter.com:80/statuses/update.xml"

                            End Sub

                            Private function NewTime
                            Dim DT
                            Dim TimePart
                            Dim AMPMPart

                            DT = Time()
                            TimePart = Left(DT, Len(DT) - 6)
                            AMPMPart = Right(DT, 3)

                            NewTime = TimePart & AMPMPart

                            End function

                            I'm having to include the time stamp because if two identical messages are sent, one after the other, the second one is ignored. This is working great me me. Much better then e-mail notifications as you can subscribe or unscribe to the message service at any time using your phone and also easier as you don't need to log into your cell phone mail app to see the message - they pop right up on my iphone display! I was having recurring issues with the hs mail delivery so I was looking for good solution.

                            Next I want to see if you can send a direct message to a twitter user. No luck so far, but maybe one of you techie guys can figure this out for me.

                            Hi can you explain where your pulling the data from for smessage is this just part of yur script cheers.
                            Mark

                            Comment


                              #29
                              The sMessage comes from another script like this

                              hs.RunEx "twitter.txt", "tweet", "Garage Door 1 is Closing"
                              Regards, Bob

                              Comment


                                #30
                                Thanks for your reply I'm going to have to read the scripting guide as I'm still struggling. I can get tweets to send but I have the problem of repeat tweets not sending so I tried your solution. I'm way too rusty at programming.

                                Mark

                                Thank you I've got it working a quick sandwich and some Salt & Vinegar Sticks managed to engage brain.
                                Cheers Mark
                                Last edited by wher2guv; July 31, 2009, 06:42 AM.

                                Comment

                                Working...
                                X