On Thu, Apr 16, 2009 at 5:11 PM, Travis James <[email protected]> wrote: > > Thank you Doug. That is where I was wrong. Is there anyway to excuse > the HTML and just get the Application Name?
I believe they've stated that will happen in API v2. Right now you just have to parse through the HTML to grok out the app name. -Chad > > On Apr 16, 12:01 pm, Doug Williams <[email protected]> wrote: >> Source parameters that come from outside apps are encoded HTML. Are you >> accounting for this Travis? See the "source" heading on the Return Values >> page [1] >> >> 1.http://apiwiki.twitter.com/Return-Values >> >> Doug Williams >> Twitter API Supporthttp://twitter.com/dougw >> >> On Thu, Apr 16, 2009 at 9:47 AM, Chad Etzel <[email protected]> wrote: >> >> > On Thu, Apr 16, 2009 at 12:35 PM, Doug Williams <[email protected]> wrote: >> > > What is the source parameter you are passing with your application? >> >> > I don't think that's what he's asking. I think he's having trouble >> > parsing the source info of tweets coming from *other* apps. I looked >> > through the Java and didn't really see where it is doing the parsing >> > so I must be missing it. I'm assuming it is looking at XML version of >> > the data? Is this for REST or Search API? >> > -Chad >> >> > > Doug Williams >> > > Twitter API Support >> > >http://twitter.com/dougw >> >> > > On Thu, Apr 16, 2009 at 7:34 AM, Travis James < >> > [email protected]> >> > > wrote: >> >> > >> package jtwitter; >> >> > >> import java.net.MalformedURLException; >> > >> import java.text.ParseException; >> > >> import java.text.SimpleDateFormat; >> > >> import java.util.Date; >> > >> import java.util.Locale; >> >> > >> public class TwitterEntry { >> >> > >> // Twitter Entry Nodes (each corresponds to a XML node with the >> > >> same >> > >> name) >> > >> public static final String CREATED_AT = "created_at"; >> > >> public static final String ID = "id"; >> > >> public static final String TEXT = "text"; >> > >> public static final String SOURCE = "source"; >> >> > >> private Date createdAt; >> > >> private int id; >> > >> private String text; >> > >> private String source; >> > >> private TwitterUser user; >> >> > >> //This is currently the date format used by twitter >> > >> public static final String TWITTER_DATE_FORMAT = "EEE MMM dd >> > >> kk:mm:ss >> > >> Z yyyy"; >> >> > >> public TwitterEntry(Date createdAt, int id, String text, String >> > >> source, TwitterUser user) { >> > >> super(); >> > >> this.createdAt = createdAt; >> > >> this.id = id; >> > >> this.text = text; >> > >> this.source = source; >> > >> this.user = user; >> > >> } >> >> > >> public TwitterEntry() { >> > >> this.user = new TwitterUser(); >> > >> } >> >> > >> public Date getCreatedAt() >> > >> { >> > >> return createdAt; >> > >> } >> >> > >> public void setCreatedAt(Date createdAt) >> > >> { >> > >> this.createdAt = createdAt; >> > >> } >> >> > >> public int getId() >> > >> { >> > >> return id; >> > >> } >> >> > >> public void setId(int id) >> > >> { >> > >> this.id = id; >> > >> } >> >> > >> public String getText() >> > >> { >> > >> return text; >> > >> } >> >> > >> public void setText(String text) >> > >> { >> > >> this.text = text; >> > >> } >> >> > >> public String getSource() >> > >> { >> > >> return source; >> > >> } >> >> > >> public void setSource(String source) >> > >> { >> > >> this.source = source; >> > >> } >> >> > >> public TwitterUser getUser() >> > >> { >> > >> return user; >> > >> } >> >> > >> public void setUser(TwitterUser user) >> > >> { >> > >> this.user = user; >> > >> } >> >> > >> �...@override >> > >> public int hashCode() >> > >> { >> > >> final int PRIME = 31; >> > >> int result = 1; >> > >> result = PRIME * result + id; >> > >> return result; >> > >> } >> >> > >> �...@override >> > >> public boolean equals(Object obj) >> > >> { >> > >> if (this == obj) >> > >> return true; >> > >> if (obj == null) >> > >> return false; >> > >> if (getClass() != obj.getClass()) >> > >> return false; >> > >> final TwitterEntry other = (TwitterEntry) obj; >> > >> if (id != other.id) >> > >> return false; >> > >> return true; >> > >> } >> >> > >> public void addAttribute(String key, String value) >> > >> throws ParseException, MalformedURLException { >> >> > >> if(key.equals(CREATED_AT)) >> > >> this.setCreatedAt(makeDate(value)); >> > >> else if(key.equals(ID)) >> > >> this.setId(Integer.parseInt(value)); >> > >> else if (key.equals(TEXT)) >> > >> this.setText(value); >> > >> else if (key.equals(SOURCE)) >> > >> this.setSource(value); >> > >> else if (key.equals(TwitterUser.NAME)) >> > >> this.getUser().setName(value); >> > >> else if (key.equals(TwitterUser.SCREEN_NAME)) >> > >> this.getUser().setScreenName(value); >> > >> else if (key.equals(TwitterUser.LOCATION)) >> > >> this.getUser().setLocation(value); >> > >> else if (key.equals(TwitterUser.DESCRIPTION)) >> > >> this.getUser().setDescription(value); >> > >> else if (key.equals(TwitterUser.PROFILE_IMAGE_URL)) >> > >> this.getUser().setProfileImageURL(value); >> > >> else if (key.equals(TwitterUser.URL)) >> > >> this.getUser().setUrl(value); >> > >> else if (key.equals(TwitterUser.IS_PROTECTED)) >> >> > >> this.getUser().setProtected(Boolean.parseBoolean(value)); >> > >> } >> >> > >> public String toString() { >> > >> return "Created At: " + this.getCreatedAt() + "; " >> > >> + "Status: " + this.getText() + "; " >> > >> + "User: " + this.getUser(); >> > >> } >> >> > >> private Date makeDate(String date) >> > >> throws ParseException { >> > >> return new SimpleDateFormat(TWITTER_DATE_FORMAT, >> > >> Locale.US).parse >> > >> (date); >> > >> } >> >> > >> } >> >> > >> On Apr 16, 7:41 am, Cameron Kaiser <[email protected]> wrote: >> > >> > > I have a Twitter application that I created in Java and I am able to >> > >> > > get the source parameter by using XMLParser. >> >> > >> > > I have my application to where it displays "Username from Source, >> > >> > > Status Text" >> >> > >> > > Username works perfectly, but source only displays when a user >> > updates >> > >> > > from the web, if they updated from a different application, all it >> > >> > > displays is "<". >> >> > >> > > Can anyone shed some light on this? >> >> > >> > A relevant section of code is always helpful. >> >> > >> > -- >> > >> > ------------------------------------ >> > >> > personal:http://www.cameronkaiser.com/-- >> > >> > Cameron Kaiser * Floodgap Systems *www.floodgap.com* >> > >> > [email protected] >> > >> > -- Put down your guns, it's Weasel Stomping Day! >> > >> > ------------------------------ >
