Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reddit spout doesn't follow 301 directive #806

Closed
bouncingbunyip opened this issue Sep 30, 2016 · 4 comments
Closed

Reddit spout doesn't follow 301 directive #806

bouncingbunyip opened this issue Sep 30, 2016 · 4 comments
Labels

Comments

@bouncingbunyip
Copy link

I have added the /r/pics/ subreddit as a spout.

Some of the entries in the subreddit return a 301, and I see the following in the items table:
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
301 Moved Permanently

301 Moved Permanently

nginx/1.4.7

This is the 'share' link on reddit to the entry:
https://www.reddit.com/r/pics/comments/555nqo/get_a_hammock_they_said/?ref=share&ref_source=link

I have seen this on a few entries but I'm not sure how to reliably 'force' it to happen.

Reading through the issues, there's a suggestion to fix the instapaper spout with:
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, TRUE);

So I've added that to my reddit2.php file_get_contents_curl() method, to see if it works. I'll keep you posted.

@jtojnar
Copy link
Member

jtojnar commented Oct 1, 2016

CURLOPT_FOLLOWLOCATION can help on some configs but not all (see safe_mode/open_basedir directives). Selfoss should migrate to something like guzzle which would solve those problems.

@niol
Copy link
Collaborator

niol commented Oct 1, 2016

Those problems have been solved for you in f3. Please use the WebClient helper:

try {
     $foo = \helpers\WebClient::request($url);
}catch( \exception $e ) {
     \F3::get('logger')->log("failed to get foo: ".$e->getMessage(), \DEBUG);
}

@jtojnar
Copy link
Member

jtojnar commented Oct 1, 2016

\helpers\WebClient cannot establish a session though. It should be possible to do with \Web but it would be probably more productive to use existing solution instead of creating our own.

@jtojnar
Copy link
Member

jtojnar commented Jan 12, 2017

Incidentally, #835 removes the need for redirect in reddit spout.

@jtojnar jtojnar closed this as completed Feb 4, 2017
@jtojnar jtojnar added the bug label Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants