First Real Application: Problems getting private xml RSS feed versions of timeline PYTHON


#1

Hey All,

First off let me just say that I wouldn’t turn to this unless it is my absolute last resort. If someone has run into this problem before then by all means just redirect me to said thread, but I could not find anything. I am a novice python programmer and I just wrote my first completely independent (no help) application.

The application I was writing was a robot that would retweet any tweet with a certain tag in it “#sometaghere” from a predefined list of users. How I went about doing this was by pulling a RSS version of the feed using the “https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=User_Name” syntax to grab pages. Once I pulled the source xml down, I went about indexing the entire page for individual tweets using tags, and then pulling out necessary and relevant information from those tweets for retweeting purposes.

So here is my problem. The page of source code that I had been developing this entire application around was a public feed. Anyone could pull down this page because of its permissions, but when I got to my own twitter feed, I found out that I could not access the same source due to the fact that it is private. Now some people would say, just change the permissions to public on the page and problem solved, but there are multiple feeds besides my own which I need to pull down who I would not ask to change their feeds to public.

Summed up, my question is, “Is there any way to authenticate and download a RSS xml source page, like the one’s I would get using the above syntax with a public feed, using a private feed?”

The application is being written in python, and I am using the python twitter wrapper for API interfacing. I am currently using it only for authenticating and posting purposes, but am hoping there is some way to get the page source of a rss feed like so. Can anyone please help? I could not find any documentation in the twitter wrapper for python which pulls down just a xml page like I need.

I know what I am doing is extremely inefficient, and I could probably be doing it better a thousand ways with code that already exists, but I would really just like to see my first program work the way I designed it to so I could learn from it…

Regards,
Morfir


#2

Hi @morfir_,

To retrieve a timeline from a protected user, you’ll need to use OAuth – this requires registering an application and negotiating access tokens. The access token will either need to belong to the user owning the user timeline or to a user who has been an approved “follower” of that account. You can read more about OAuth here: [node:3062].

I would also recommend not using the RSS feed but instead use JSON or XML response formats. These have richer data within them, especially when you use the include_entities=true modifier – hashtags, links, and other interesting data will be isolated from the response to make it easier for you to key off the data.


#3

You mentioned using JSON or XML formats… Is the RSS feed not in a XML format already?

I understand that the twitter API has all of the things I would need to make this program work, however I wanted to try and design a program that relied as little as possible on the API for learning purposes. The only thing I am using it for currently is Posting to twitter, and I would like to keep it that way if at all possible. Is there a way I can pull down a timeline that is in a XML format like the RSS feed I have been pulling down from public users, but after authenticating with OAuth?