You are here

private function FeedsCrawler::parseAuto in Feeds Crawler 6.2

Same name and namespace in other branches
  1. 7 FeedsCrawler.inc \FeedsCrawler::parseAuto()
1 call to FeedsCrawler::parseAuto()
FeedsCrawler::fetch in ./FeedsCrawler.inc
Implements FeedsFetcher::fetch().

File

./FeedsCrawler.inc, line 74
Home of the FeedsCrawler.

Class

FeedsCrawler
Fetches data via HTTP.

Code

private function parseAuto($result, $source_config) {
  $xml = new SimpleXMLElement($result
    ->getRaw());
  feeds_include_library('common_syndication_parser.inc', 'common_syndication_parser');
  $format = _parser_common_syndication_feed_format_detect($xml);
  if ($format) {
    $xml
      ->registerXpathNamespace('atom', 'http://www.w3.org/2005/Atom');
    $xpath = 'atom:link[@rel="next"]/@href';
  }
  else {
    $xpath = 'link[@rel="next"]/@href';
  }
  $href = $xml
    ->xpath($xpath);
  unset($xml);
  return $this
    ->parseHref($href, $source_config['source']);
}