Merge pull request #2293 from mexon/mat/pullrequest4

Use more cookies to allow processing of the NYT feed
This commit is contained in:
fabrixxm 2016-01-25 10:52:48 +01:00
commit 0e6f3e6122
2 changed files with 9 additions and 3 deletions

View file

@ -235,7 +235,9 @@ function scrape_feed($url) {
$a = get_app(); $a = get_app();
$ret = array(); $ret = array();
$s = fetch_url($url); $cookiejar = tempnam(get_temppath(), 'cookiejar-scrape-feed-');
$s = fetch_url($url, false, $redirects, 0, Null, $cookiejar);
unlink($cookiejar);
$headers = $a->get_curl_headers(); $headers = $a->get_curl_headers();
$code = $a->get_curl_code(); $code = $a->get_curl_code();
@ -662,7 +664,9 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
$vcard['photo'] = $feedret['photo']; $vcard['photo'] = $feedret['photo'];
require_once('library/simplepie/simplepie.inc'); require_once('library/simplepie/simplepie.inc');
$feed = new SimplePie(); $feed = new SimplePie();
$xml = fetch_url($poll); $cookiejar = tempnam(get_temppath(), 'cookiejar-scrape-feed-');
$xml = fetch_url($poll, false, $redirects, 0, Null, $cookiejar);
unlink($cookiejar);
logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA); logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
$a = get_app(); $a = get_app();

View file

@ -335,7 +335,9 @@ function onepoll_run(&$argv, &$argc){
if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly'])
return; return;
$xml = fetch_url($contact['poll']); $cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
$xml = fetch_url($contact['poll'], false, $redirects, 0, Null, $cookiejar);
unlink($cookiejar);
} }
elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) { elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) {