toppa / Shashin

A WordPress plugin for displaying photos and videos from Google+, Youtube, and Twitpic
http://www.toppa.com/shashin-wordpress-plugin/
GNU General Public License v3.0
24 stars 10 forks source link

Failed to retrieve album feed at .... #28

Closed kmatthews812 closed 12 years ago

kmatthews812 commented 12 years ago

I was running Shashin v2 on my host Siteground.com just fine. I upgraded and it asked me to "sync all" in order to complete the upgrade. Whenever I try to sync all existing albums, sync one, or import a new album, I get the dreaded error:

"Failed to retrieve album feed at http://picasaweb.google.com/data/feed/api/user/kevin.matthews/albumid/5669032831219584017?kind=photo&alt=json"

Here are a few details:

WP Version: 3.2.1 PHP Version: 5.3.6 Shashin Version: 3.0.5

The existing albums were imported with v2, but I'm trying to move them to v3. I set the "Support old-style Shashin shortcodes?" to "Yes" and they still display on existing posts just fine.

When importing a new album, I have tried the following album links and they all fail:

https://picasaweb.google.com/data/feed/base/user/michaeltoppa/albumid/5590273039059471873?alt=rss&kind=photo&hl=en_US http://picasaweb.google.com/data/feed/base/user/michaeltoppa/albumid/5590273039059471873?alt=rss&kind=photo&hl=en_US https://picasaweb.google.com/data/feed/base/user/kevin.matthews/albumid/5675310629275932449?alt=rss&kind=photo&hl=en_US http://picasaweb.google.com/data/feed/base/user/kevin.matthews/albumid/5675310629275932449?alt=rss&kind=photo&hl=en_US

When trying to refresh existing albums, these links all fail:

https://picasaweb.google.com/data/feed/api/user/kevin.matthews/albumid/5650833995240953297?kind=photo&alt=json http://picasaweb.google.com/data/feed/api/user/kevin.matthews/albumid/5650833995240953297?kind=photo&alt=json

When I had v2 installed, https picasa links never worked. I always had to use http links. My host will open up ports for me, so if the new version making picasa pull requests on an unusual port, I need to know the port number.

Thanks!

Kev

toppa commented 12 years ago

Shashin 3 uses the WordPress WP_Http request object to retrieve the feeds, so there is no special port used or anything like that. If you are comfortable editing code, please open shashin/Admin/ShashinSynchronizer.php and go to line 86, where you will see:

if (!is_array($response)) {
    throw new Exception(__("Failed to retrieve album feed at ", "shashin") . $this->jsonUrl);
}

change it to:

if (!is_array($response)) {
    var_dump($response);
    exit;
    throw new Exception(__("Failed to retrieve album feed at ", "shashin") . $this->jsonUrl);
}

then when you try to add or sync and album, I expect it'll show the contents of a WP_Error object. Please copy and paste the output here so I can see. Thanks!

If you're not comfortable editing the code, that's ok - I can email at edited file to you - let me know.

kmatthews812 commented 12 years ago

OK, no problem. I edited the code and tried to re-sync an existing album. Here is the error:

"object(WP_Error)#184 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(20) "connect() timed out!" } } ["error_data"]=> array(0) { } } "

I get the same error when I try to add a new album with the following url: http://picasaweb.google.com/data/feed/base/user/michaeltoppa/albumid/5590273039059471873?alt=rss&kind=photo&hl=en_US

So the server cannot reach google, which is strange, because this used to work in v2. Any ideas?

Thanks,

Kev

kmatthews812 commented 12 years ago

I checked with my host and they verified that port 80 is open from my server to picasa. They also verified it by connecting with telnet. So something is wrong with the application. Any ideas?

Does this rely on curl?

Thanks,

Kev

kmatthews812 commented 12 years ago

OK, I've been playing with the code a bit and while I haven't fixed it, this is far as I can go. I have been playing with the WP_Http class. It can make requests to sites like cnn.com from my host, but it has a problem with picasaweb.google.com. It always times out on the dns lookup, but only for that domain.

I have tried replacing the picasaweb domain with the IP address I get when I ping it, but it seems to be forwarding dynamically, so this results in 404 errors. I have tried setting the timeout very high, as well as the redirect count, and I have played with the content-type headers (application/json and application/rss+xml) and user-agent, but all to no avail. I have also set the username and password to my account and forced it to use SSL, but again, no luck. I have also verified that my host can connect to picasaweb and it is not a firewall issue.

You probably can't reproduce this on your side, so I understand if you can't help me. Just figured I would add some info to this thread in case it jiggles anybody's memory as to how to fix it. Otherwise, I'm going to have to try a different plugin.

toppa commented 12 years ago

Thanks for your debugging efforts. Version 2.6 of Shashin used a library that came with WordPress called "Snoopy". In the current version of WordPress, the WordPress team has deprecated Snoopy in favor of the WP_HTTP class, so I updated Shashin accordingly. Snoopy is still there in wordpress though (but may be removed in a future version).

You could make some changes yourself to Shashin 3 if you want to try to make it work with Snoopy. Let me know if you want to try that and I can let you know which parts of the code would need updating. That would make upgrades more difficult for you though, as you'd need to keep track of your own changes.

kmatthews812 commented 12 years ago

Can you post a link to the 2.6 version of the code where you use snoopy to make the http call? I can just copy that into 3.0 and edit it so it gets a json document using snoopy. Hopefully from there the rest of the code should work without any changes.

Thanks.

toppa commented 12 years ago

Hi Kev - sorry, I meant to reply sooner. If you send me a message through the contact form on my site, I can email you a zipped copy of 2.6.3, and point out where to make the changes in the code. http://www.toppa.com/contact

toppa commented 12 years ago

I discovered there is a timeout setting for the WP_Http call, so I added a 30 second timeout. Hopefully that will help.