MGTwitterStatusesYAJLParser chokes on <geo> and <coordinate> stuff #9

Closed
justin opened this Issue Mar 23, 2010 · 3 comments

Projects

None yet

2 participants

@justin
Contributor
justin commented Mar 23, 2010

The current iteration of the MGTwitterStatusesYAJLParser classes don't handle the geolocation stuff that Twitter has added in.

I've got a rewritten version that handles it a bit more gracefully. Need to clean it up a bit, but I'll post a Gist when it's ready.

@stevestreza
Collaborator

This seems to have been fixed; I'm guessing by this: cd849b2

Result dict looks like this:

{
    contributors = <null>;
    coordinates =         {
        coordinates = -74;
        type = Point;
    };
    "created_at" = 1272822404;
    favorited = 0;
    geo =         {
        coordinates = 40;
        type = Point;
    };
    id = 13257557083;
    "in_reply_to_screen_name" = <null>;
    "in_reply_to_status_id" = <null>;
    "in_reply_to_user_id" = <null>;
    place =         {
        "bounding_box" =             {
            coordinates = -74;
            type = Polygon;
        };
        country = "The United States of America";
        "country_code" = US;
        "full_name" = "Weehawken, NJ";
        id = e140ee270249a06e;
        name = Weehawken;
        "place_type" = city;
        "street_address" = "";
        url = "http://api.twitter.com/1/geo/id/e140ee270249a06e.json";
    };
    source = "<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>";
    "source_api_request_type" = 1;
    text = "Had a nice pre-stateroom visit with @Ihnatko @siegel @kerri9494 and @laurengsnell #macmania";
    truncated = 0;
    user =         {
        "contributors_enabled" = 0;
        "created_at" = 1172016248;
        description = "Editor of Macworld, writer, primate, skeptic";
        "favourites_count" = 138;
        "followers_count" = 13096;
        following = 1;
        "friends_count" = 263;
        "geo_enabled" = 1;
        id = 784912;
        lang = en;
        location = "Mill Valley, CA";
        name = "Jason Snell";
        notifications = 0;
        "profile_background_color" = 061C69;
        "profile_background_image_url" = "http://a3.twimg.com/profile_background_images/17696657/m101_hst.jpg";
        "profile_background_tile" = 1;
        "profile_image_url" = "http://a3.twimg.com/profile_images/750510543/jason-square_normal.jpg";
        "profile_link_color" = 000099;
        "profile_sidebar_border_color" = 000000;
        "profile_sidebar_fill_color" = 3399FF;
        "profile_text_color" = 000000;
        protected = 0;
        "screen_name" = jsnell;
        "statuses_count" = 17603;
        "time_zone" = "Pacific Time (US & Canada)";
        url = "http://www.intertext.com/";
        "utc_offset" = -28800;
        verified = 0;
    };
}
@stevestreza
Collaborator

Doh, scratch that, the coordinates data isn't being parsed properly.

@stevestreza
Collaborator

There, should be fixed in 22c17d0. Output:

{
    contributors = <null>;
    coordinates =     {
        coordinates =         (
            -74.02340859,
            40.76473355
        );
        type = Point;
    };
    "created_at" = 1272822404;
    favorited = 0;
    geo =     {
        coordinates =         (
            40.76473355,
            -74.02340859
        );
        type = Point;
    };
    id = 13257557083;
    "in_reply_to_screen_name" = <null>;
    "in_reply_to_status_id" = <null>;
    "in_reply_to_user_id" = <null>;
    place =     {
        "bounding_box" =         {
            coordinates =             (
                                (
                ),
                                (
                ),
                -74.03223,
                40.756601,
                                (
                ),
                -74.001327,
                40.756601,
                                (
                ),
                -74.001327,
                40.780685,
                                (
                ),
                -74.03223,
                40.780685
            );
            type = Polygon;
        };
        country = "The United States of America";
        "country_code" = US;
        "full_name" = "Weehawken, NJ";
        id = e140ee270249a06e;
        name = Weehawken;
        "place_type" = city;
        "street_address" = "";
        url = "http://api.twitter.com/1/geo/id/e140ee270249a06e.json";
    };
    source = "<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>";
    "source_api_request_type" = 5;
    text = "Had a nice pre-stateroom visit with @Ihnatko @siegel @kerri9494 and @laurengsnell #macmania";
    truncated = 0;
    user =     {
        "contributors_enabled" = 0;
        "created_at" = 1172016248;
        description = "Editor of Macworld, writer, primate, skeptic";
        "favourites_count" = 138;
        "followers_count" = 13096;
        following = 1;
        "friends_count" = 263;
        "geo_enabled" = 1;
        id = 784912;
        lang = en;
        location = "Mill Valley, CA";
        name = "Jason Snell";
        notifications = 0;
        "profile_background_color" = 061C69;
        "profile_background_image_url" = "http://a3.twimg.com/profile_background_images/17696657/m101_hst.jpg";
        "profile_background_tile" = 1;
        "profile_image_url" = "http://a3.twimg.com/profile_images/750510543/jason-square_normal.jpg";
        "profile_link_color" = 000099;
        "profile_sidebar_border_color" = 000000;
        "profile_sidebar_fill_color" = 3399FF;
        "profile_text_color" = 000000;
        protected = 0;
        "screen_name" = jsnell;
        "statuses_count" = 17603;
        "time_zone" = "Pacific Time (US & Canada)";
        url = "http://www.intertext.com/";
        "utc_offset" = -28800;
        verified = 0;
    };
}
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment