Giter Site home page Giter Site logo

Comments (9)

habuma avatar habuma commented on August 28, 2024

Thanks for reporting this issue. I've not seen the "swf" type (it's not even in their docs, from what I can tell), but I'm guessing it's a SWF file that the user has posted. I'll try to recreate this and fix it.

I've created an issue to resolve this in https://jira.springsource.org/browse/SOCIAL-221. To help out, could you attach some JSON for the feed that has the "swf" post in it to that issue? That would help me to be sure that I'm hitting the same problem you're hitting.

from spring-social-facebook.

 avatar commented on August 28, 2024

First, I was afraid that I may have to customize spring-social-facebook further (so far I've only added the fetch image url method I mentioned previously) before I can get to the json data that you requested. Since it's been like a day, that specific post is probably older than the most recent 50 posts in my facebook account, and your current facebook api does not support sending extra query parameters to fetch older posts.

Anyhow, I tried and voila, got another problem. This time the type is null. It crashes somewhere earlier in my code when I use Post.getType() and it returns null. Debugging, I can see that this corresponds to a PhotoPost. All returned values are filled ok - id, photoid, from, picture, name, etc. - except type has returned as null. Based on the Facebook docs for GraphAPI, I would have expected a type of 'photo', and I certainly did not expect a null value.

Am I the only one getting inconsistent values back from Facebook? If I can get two in a row, I'd have expected a lot more complaints from other developers using spring-social-facebook? Anyhow, I can also add that this is not a regular photo post, but it's via their Mobile Uploads.

I will try to skip this post in my code by checking for null type, and get details for the swf type, if I can. But it sure looks their api is returning inconsistent values so far.

By the way, I also tried accessing the photo directly via its graph url in the browser, and I got the following json instead:

{
"error": {
"type": "GraphMethodException",
"message": "Unsupported get request."
}
}

The photo post looks fine when I visit my facebook page. I double checked that it's the correct match by inspecting the element.

from spring-social-facebook.

habuma avatar habuma commented on August 28, 2024

I've seen inconsistencies in FB before, but not like those you're seeing. There are several oddities (undocumented at that) in the FB Graph API and perhaps you've stumbled on a couple that nobody else has before.

You might try to get the JSON using https://developers.facebook.com/tools/explorer. Maybe you'll have better luck there. If this is a public feed, I could also use it as I debug, but you seem to indicate that it's your personal feed, so it's probably not publicly readable.

I'm looking into this right now. I'm starting by figuring out how best to handle an unknown/unrecognized type. That will at least prevent the error. Then I'll see about handling "swf".

from spring-social-facebook.

habuma avatar habuma commented on August 28, 2024

Oops...accidentally clicked the wrong button when posting the previous comment.

from spring-social-facebook.

 avatar commented on August 28, 2024
  1. I've tried to get hold of the problematic 'swf' post, yet unsuccessful so far. I should have written down the corresponding id when I first encountered it. However, I did go through posted videos on my home page and here's what I observe. I can reach to json data using its graph url for youtube videos and such, but I found several posted swf objects and attempts to access their json data returns an error json or simply 'false'. Hence I can't see what their type values are, and cannot verify that they were the problem.
  2. Using the latest spring-social-facebook source (as of 7.11.2011), I printed the jsonNode variable from the deserializeDataList method in FacebookTemplate - only for my most recent posts which unfortunately don't have any swf objects yet. Everything looks fine with correct type values such as link, photo, status, video, etc. However, in my code, Post.getType() returns null for all of them. Debugging, I can verify that the type property within the corresponding Post object is indeed null, while everything else is set correctly. Is this a bug, or on purpose in the new source? I could go back to RC1, but then there is no deserializeDataList method, and I cannot simply print and view the json data to check for issues. Plus my code is using type info to determine individual post formats - I wouldn't like to use instanceof checks to determine individual post types.

from spring-social-facebook.

habuma avatar habuma commented on August 28, 2024

No worries on not being able to provide the JSON. I've been able to post a SWF and get a feed item with an "swf" type. I also played around and discovered that posting an MP3 results in a feed item with a "music" type. Note that as far as I can find, neither of these types is documented by FB and that leaves me wondering what other types there are that aren't documented. So, the first fix for this problem is to gracefully deal with unrecognized post types.

As for #2, I noticed the same thing in my testing (the null types) and will be working to correct that, too.

from spring-social-facebook.

 avatar commented on August 28, 2024

thanks for confirming - after so many things going wrong, I started getting worried that I might be messing something up.

I probably shouldn't keep adding to this thread, but it is kind of related... Playing around with the graph api to fetch older posts, I can't get anything more than 25. The limit parameter doesn't seem to have any effect, offset or the until/since timestamps don't help either or sometimes return jsons with empty data sets. Also, there are gaps in the stream, certain posts are simply discarded by the graph api - even though I'm using their explorer tool with an access token based on my account. There also seem to be quite a few complaints and confusion when I search for these issues on the internet.

Now, these are all issues or inconsistencies with facebook, but what I want to ask is what are your plans for handling feeds. I think currently the api just returns the most recent feeds - whatever facebook decides to send. Yet for any application dealing with feeds, paging, searching will be essential. Is this something you plan to support? If so, roughly when on the roadmap? Facebook has also introduced real-time subscriptions - any plans to support that? And how to allow spring social developers to deal with facebook api inconsistencies as they come up?

thanks a lot for your help :)

from spring-social-facebook.

habuma avatar habuma commented on August 28, 2024

I've just pushed a new snapshot build of the Facebook module that should treat any unrecognized types generically as a Post object and also addresses the null returned from getType(). Let me know if it works for you.

If so, that addresses the defect, but leaves opportunity for improvement to explicitly handle "swf" and "music" types. So, if this works for you, I'll close the defect, but create separate improvement issues for the new types.

I'll respond to your other questions soon.

from spring-social-facebook.

 avatar commented on August 28, 2024

Thanks. I have to leave on a trip, so I only got a chance to take a quick look, but it worked fine. I didn't get a chance to check closer but I assume that the generic Post object has all possible properties documented by facebook, so if it's a generic Post we could have methods/conditions for checking property values and deciding what we want to do with it. I hope that facebook doesn't add new properties or remove existing ones, as easy as they change their 'enum' values :)

from spring-social-facebook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.