Daily Rotation on Twitter

Shell City and/or Daily Rotation -- Got something to say?

Postby Gerry » 12/21/09, 1:16 am

bob wrote:Once twitterfeed actually starts working (or su.pr) we'll see how that number one headline tweet works out, and then create a second feed using the scripts discussed above.


Have you tried to use the API

I think you can use it like this in Perl:
Code: Select all
use LWP::Simple;

my $url = 'http://su.pr/api/post?msg=<HEADLINE_TEXT> <HEADLINE_URL>&services;[]=twitter&services;[]=facebook&login=<YOUR_SU_PR_USERNAME>&apiKey=<YOUR_SU_PR_API_KEY>

# Example:
# my $url = 'http://su.pr/api/post?msg=Firefox 3.5 Now the Most Popular Browser Worldwide http://rss.slashdot.org/~r/Slashdot/slashdot/~3/GHKdXO9oTbc/Firefox-35-Now-the-Most-Popular-Browser-Worldwide&services;[]=twitter&services;[]=facebook&login=bob&apiKey=djsfklj3kjldfs

my $response = get $url;
die 'Error getting $url' unless defined $response;


You can get the API key here: http://su.pr/settings/
Gerry
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 5727
Joined: 12/04/01, 12:00 am
Location: Perth, Western Australia

Postby bob » 12/21/09, 12:45 pm

Thanks, Gerry. I'll check that out--just discovered an unexpected problem withj one script I need to fix first.

I'd looked at the api before, and intended to use it, at your suggestion, but the code above confuses me a bit. Let me ask you this, what if you only want to post to twitter and not facebook? Do you just use the same code above still? Or do you remove the facebook part? And if you do, exactly where does the facebook part begin and end?

Or is it just a matter of only activating twitter in your su.pr settings? (Might do facebook too--though my page there is kind of barren.....)
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby Gerry » 12/21/09, 2:21 pm

You would need to remove this section:
Code: Select all
services;[]=facebook

and one of the surrounding ampersand characters.

For facebook I suggest you set up a fan page for Daily Rotation and post to that instead of your regular profile: http://www.facebook.com/advertising/?pages
Gerry
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 5727
Joined: 12/04/01, 12:00 am
Location: Perth, Western Australia

Postby bob » 12/22/09, 9:21 pm

I think twitterfeed is working now. Might have been my fault. I added a unique identifier to each link, and it started working. They all still come to DR now though. And they're all the current top headline. I'm considering putting a "Twitterbox" at the top of the page if users come in on a twitter link though, with maybe the last 5 headlines tweeted. Problem still is, if someone comes in on yesterday's tweet, today's headline might be long gone. Too bad you can't destroy tweets after 2 hours or something similar....

Still looking at going through the su.pr api.... That is my next project. I definitely like stumbleupon.
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby bob » 12/24/09, 12:18 am

Cleaned up the script using the su.pr api, what you had above, Gerry -- script works... But no posts on twitter.... or stumbleupon...

Here's mine. See anything wrong with it?:

Code: Select all
#!/usr/bin/perl -w

print "Content-type: text/html\n\n";


use LWP::Simple;

my $url = 'http://su.pr/api/post?msg=Shell Extension City http://www.shellcity.net&services;[]=twitter&login=dailyrotation&apiKey=vvvvvv';
my $response = get $url;
die 'Error getting $url' unless defined $response;
Last edited by bob on 12/24/09, 1:24 am, edited 1 time in total.
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby bob » 12/24/09, 12:32 am

Content type is text/htmlcharset=UTF-8Content is:{"errorCode":1302,"errorMessage":"Facebook Authentication Failed","statusCode":"ERROR"}
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby bob » 12/24/09, 12:34 am

Got the above error from this:


Code: Select all
#!/usr/bin/perl -w

print "Content-type: text/html\n\n";

use LWP;
my $browser = LWP::UserAgent->new;
my $url = 'http://su.pr/api/post?msg=Shell Extension City http://www.shellcity.net&services;[]=twitter&login=dailyrotation&apiKey=xxxx';

# Issue request, with an HTTP header
my $response = $browser->get($url,
  'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 7.0)',
);
die 'Error getting $url' unless $response->is_success;
print 'Content type is ', $response->content_type;
print 'Content is:';
print $response->content;





So I'm wondering about that facebook part of the request, which I left out.
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby Gerry » 12/24/09, 6:36 am

as you know it shouldn't be trying to post to facebook, however authorise su.pr to connect to your facebook anyway by your settings and then try again. If it actually does post to your facebook you can delete the post it and at least you will know it actually can make posts. If authorising your FB account makes the script run further and output another error message, then this will probably help us track down the problem.
Gerry
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 5727
Joined: 12/04/01, 12:00 am
Location: Perth, Western Australia

Postby bob » 12/24/09, 8:19 pm

I'll take a shot at it. Got a flu or something. Maybe later today. Also, I see a problem with the other tweet script. It shouldn't have double posted, though I know why it did. Got to somehow take account of the case where the top headline falls from top position and then comes back again... Got a little idea about that, but it'll be a bit more complex.. Zzzzzz right now. Gonna be sick for christmas.....
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby Gerry » 12/26/09, 7:27 am

:( Merry Christmas Bob. Hope you feel better soon.
Gerry
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 5727
Joined: 12/04/01, 12:00 am
Location: Perth, Western Australia

Postby bob » 12/28/09, 5:54 pm

Been sick--better now. Thanks for the Merry Christmas words, Gerry.... BTW, is it true that you guys have Christmas in the middle of the summer? I mean, isn't December your hottest temperature month? That would feel really weird to me.

Anyway, I think I've got the DR Twitterfeed script set up so there can be no repeats now. We'll see...

Starting again on the su.pr script.
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby Gerry » 12/29/09, 12:24 pm

bob wrote:Been sick--better now. Thanks for the Merry Christmas words, Gerry.... BTW, is it true that you guys have Christmas in the middle of the summer? I mean, isn't December your hottest temperature month? That would feel really weird to me.

Anyway, I think I've got the DR Twitterfeed script set up so there can be no repeats now. We'll see...

Starting again on the su.pr script.


Yes it's been very friggin hot! Just look at those max tempatures: http://www.timeanddate.com/weather/aust ... h/historic

Temp 41 °C 29 Dec at 10:30 AM
Humidity 88% 28 Dec at 1:00 AM

It's been friggin hot and humid! :( I've experienced both snow and heat at xmas, both for many years, so both seem normal to me now just depending on where I am. In the southern hem Christmas is more about the outdoors. You go to the beach / have a bbq etc. Santa wears shorts and arrives by jetski/boat instead of sled :) It's just as fun as having it in cold weather. Both have advantages and disadvantages.
Gerry
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 5727
Joined: 12/04/01, 12:00 am
Location: Perth, Western Australia

Postby bob » 12/29/09, 1:44 pm

WOW __
Temp 41 °C 29 Dec at 10:30 AM


That's 106 F.? HOLY SHIT! That's like living in Death Valley. I'm surprised you're not dragging yourself across the desert floor crying for water....

As I think about it, I'd better look up St. Louis temps--I do remember 106 degrees one day in the 1970's (my dad and I got so sick of the long hot spell--we got on a plane, and went to Reno, which was in the 70's that week.

For St. Louis:

The average high temperature in July is 88.4 °F (32 °C), and the average low temperature in January is 22.6 °F (&#8722;6 °C), although these values are often exceeded. Temperatures of 0 °F or below occur 3 days per year on average.[4] The highest temperature ever recorded in St. Louis was 115 °F (46 °C), on July 14, 1954, while the lowest temperature on record is &#8722;23 °F (&#8722;31 °C), on January 29, 1873[5]


http://en.wikipedia.org/wiki/St._Louis_ ... ri#Climate
Last edited by bob on 12/29/09, 1:54 pm, edited 1 time in total.
WYSIWTF
bob
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 7565
Joined: 12/03/01, 12:00 am
Location: St. Louis

Postby Gerry » 12/30/09, 12:56 pm

It's not that bad with aircon and I should add that those sort of tempatures are quite common in summer. :( The temp alone doesn't really matter though, it's the high humidity that makes you feel horrible. It's like being in a sauna.

http://en.wikipedia.org/wiki/Perth,_Wes ... ia#Climate

Climate
Perth receives moderate though highly seasonal rainfall. Summers are generally hot and dry, lasting from December to late March, with February generally being the hottest month of the year, making Perth a classic example of a Mediterranean climate (Köppen climate classification CSa).[31] Summer is not completely devoid of rain with sporadic rainfall in the form of short-lived thunderstorms, weak cold fronts and on very rare occasions decaying tropical cyclones from Western Australia's north-west which can bring significant falls. The hottest ever recorded temperature in Perth was 46.2 °C (115.2 °F) on 23 February 1991, although Perth Airport recorded 46.7 °C (116.1 °F) on the same day.[32][33] On most summer afternoons a sea breeze, also known as "The Fremantle Doctor", blows from the south-west, providing relief from the hot north-easterly winds. Temperatures often fall below 30 degrees a few hours after the arrival of the wind change.[34]
Winters are relatively cool and wet, with most of Perth's annual rainfall falling between May and September. The coldest temperature recorded in Perth was &#8722;0.7 °C (31 °F) on 17 June 2006.[32] The coldest temperature within the Perth metropolitan area was -3.4 °C (25.9 °F) on the same day at Jandakot Airport.[35]
[list=][/list]
Gerry
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 5727
Joined: 12/04/01, 12:00 am
Location: Perth, Western Australia

Postby Gerry » 12/30/09, 1:00 pm

Anyway, back on topic. I'm seeing the headlines on twitter now and I'm wishing it didn't just take me to DR. It would be much better to have a custom page for that link. Perhaps you could do it like su.pr where you load the page in a frame below and in the frame above you have a link where they can check out the other DR headlines?
Gerry
BIG GIANT HEAD I Get Free Beer
BIG GIANT HEAD I Get Free Beer
 
Posts: 5727
Joined: 12/04/01, 12:00 am
Location: Perth, Western Australia

PreviousNext

Return to Site Stuff

Who is online

Users browsing this forum: No registered users and 1 guest

cron