Blog posts feeds - maps format to the correct feed view.
339248
def blog_post_feed(request, format, **kwargs):
    
    try:
        return {"rss": PostsRSS, "atom": PostsAtom}[format](**kwargs)(request)
    except KeyError:
        raise Http404()
1226560
function filterLayout(posts) {
      var reLayout = new RegExp(layout, 'i');

      return posts.filter(function filterPosts(post) {
        return reLayout.test(post.layout);
      });
    }
257486
function(feed, summarise) {
    var template = ''
      , url = this.config.url
      , title = this.config.title
      , perPage = this.config.perPage
      , posts = this.posts.slice(0, perPage)
      , site = this;

    summarise = typeof summarise === 'boolean' && summarise ? 3 : summarise;
    perPage = site.posts.length < perPage ? site.posts.length : perPage;

    template += '!!!xml\n';
    template += 'feed(xmlns="http://www.w3.org/2005/Atom")\n';
    template += '  title #{title}\n';
    template += '  link(href=feed, rel="self")\n';
    template += '  link(href=url)\n';

    if (posts.length > 0)
      template += '  updated #{dx(posts[0].date)}\n';

    template += '  id #{url}\n';
    template += '  author\n';
    template += '    name #{title}\n';
    template += '  - for (var i = 0, post = posts[i]; i < ' + perPage + '; i++, post = posts[i])\n';
    template += '    entry\n';
    template += '      title #{post.title}\n';
    template += '      link(href=url + post.url)\n';
    template += '      updated #{dx(post.date)}\n';
    template += '      id #{url.replace(/\\/$/, "")}#{post.url}\n';

    if (summarise)
      template += '      content(type="html") !{h(truncateParagraphs(post.content, summarise, ""))}\n';
    else
      template += '      content(type="html") !{h(post.content)}\n';

    return helpers.render(template, { locals: site.applyHelpers({
        paginator: site.paginator
      , posts: posts
      , title: title
      , url: url
      , feed: feed
      , summarise: summarise
    })});
  }
1008163
def in_feed(self, feed):
        ''''''
        kwargs = {self.model._rel_to_feed: feed}
        return self.filter(**kwargs)
436741
private static function createFeedMapping(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        DSAFeedDetails $feedDetails
    ) {
        $feedMappingService = $adWordsServices->get($session, FeedMappingService::class);

        // Map the feed attribute IDs to the field ID constants.
        $urlFieldMapping = new AttributeFieldMapping();
        $urlFieldMapping->setFeedAttributeId(
            $feedDetails->urlAttributeId
        );
        $urlFieldMapping->setFieldId(self::DSA_PAGE_URLS_FIELD_ID);
        $labelFieldMapping = new AttributeFieldMapping();
        $labelFieldMapping->setFeedAttributeId(
            $feedDetails->labelAttributeId
        );
        $labelFieldMapping->setFieldId(self::DSA_LABEL_FIELD_ID);

        // Create the feed mapping and feed mapping operation.
        $feedMapping = new FeedMapping();
        $feedMapping->setCriterionType(self::DSA_PAGE_FEED_CRITERION_TYPE);
        $feedMapping->setFeedId($feedDetails->feedId);
        $feedMapping->setAttributeFieldMappings(
            [$urlFieldMapping, $labelFieldMapping]
        );

        $operation = new FeedMappingOperation();
        $operation->setOperand($feedMapping);
        $operation->setOperator(Operator::ADD);

        // Create the feed mapping operation on the server and print out some
        // information.
        $result = $feedMappingService->mutate([$operation]);
        $feedMapping = $result->getValue()[0];
        printf(
            "Feed mapping with ID %d and criterion type %d was saved for feed with ID %d.\n",
            $feedMapping->getFeedMappingId(),
            $feedMapping->getCriterionType(),
            $feedMapping->getFeedId()
        );
    }
35174
function(data) {
      var pretty_columns = {};

      var column_names = this.column_names;

      var i = 0;
      var l = column_names.length;

      for (; i < l; i++) {
        if (typeof data.feed.entry[i].content.$t !== 'undefined') {
          pretty_columns[column_names[i]] = data.feed.entry[i].content.$t;
        } else {
          pretty_columns[column_names[i]] = column_names[i];
        }
      }

      this.pretty_columns = pretty_columns;

      this.prettifyElements();
      this.ready();
    }
556929
public function feed()
    {
        $expression = "/^" . preg_quote($this->name, "/") . "(.)*[0-9]+$/";
        $this->setValues(array());
        foreach ($_POST as $key => $value) {
            if (preg_match($expression, $key)) {
                $this->addValue(tao_helpers_Uri::decode($value));
            }
        }
    }
254521
function processFeed(feed) {

	var feedName = ('nitro-'+feed.name).toCamelCase();
	var s = '/**\n';
	s += '* '+feed.title+'\n';
	s += '*/\n';
	fs.appendFileSync(apijs, s+'const '+feedName+" = '"+feed.href+"';\n", 'utf8');
	cache.push(feedName+' : '+feedName+',\n');

	var pathname = feed.href.replace('/nitro/api','');
	var path = openapi.paths[pathname] = {};
	path.get = {};
	path.get.description = feed.title;
	path.get.tags = ['feeds'];
	path.get.summary = feed.title;

	// a long time ago, in a galaxy far, far away, the API had longer descriptions. Some taken from https://developer.bbc.co.uk/content/
	if (feed.name == 'Programmes') {
		path.get.description = 'Fetch metadata about Programmes (brands, series, episodes, clips). By applying different filter restrictions this feed can be used in many ways, for example to retrieve all series belonging to a brand, all the episodes and/or clips for a specific series, or any TLEO objects for a masterbrand. Other filters permit restricting to specific formats and/or genres, and you can request specific versions (for example Signed or Audio-Described). Parameters may be combined in any way suitable for your application.';
	}
	else if (feed.name == 'Broadcasts') {
		path.get.description = 'Fetch metadata about linear Broadcasts and Services, allowing the generation of Television and Radio schedules and other datasets for broadcast items. Use /schedules instead of this feed as it is more efficient. Broadcasts will be deprecated in the future.';
	}
	else if (feed.name == 'Schedules') {
		path.get.description = 'Dates, Times, Schedules: when and where are programmes being shown?';
	}
	else if (feed.name == 'Versions') {
		path.get.description = 'The versions feed exposes editorial "Versions" of programmes. These are concepts used to capture different presentations of an overall programme: for example, versions of a programme may include one with sign language, one with audio description, one edited for content and more. Versions are also important to understand for broadcasts: a linear broadcast or an ondemand is always of a specific version, not merely of a programme.';
	}
	else if (feed.name == 'Services') {
		path.get.description = 'The services feed exposes the linear broadcast "services" from PIPs. These are the actual services which broadcast programmes (eg bbc_one_oxford is the service for BBC One in Oxford).';
	}
	else if (feed.name == 'People') {
		path.get.description = 'The People feed allows you to search for the people and groups that contribute to programmes. This is the starting point for cast and crew credits, as well as finding contributors using external IDs (such as Wikipedia URLs)';
	}
	else if (feed.name == 'Availabilities') {
		path.get.description = 'For advanced users only: Use the availabilities feed to discover details of on-demand availability for programmes and their versions.';
	}
	else if (feed.name == 'Images') {
		path.get.description = 'Find metadata for images, particularly those in galleries';
	}
	else if (feed.name == 'Promotions') {
		path.get.description = 'Details of short-term editorially curated "promotions", for instance those programmes featured on iPlayer today';
	}
	else if (feed.name == 'Groups') {
		path.get.description = 'Long-lived curated collections of programmes and more, including Collections, Seasons, Franchises and Galleries';
	}

	path.get.operationId = 'list'+feed.name;
	params = path.get.parameters = [];

	path.get.responses = {};
	path.get.responses['200'] = {};
	path.get.responses['200'].description = 'Nitro response';
	path.get.responses['200'].content = {};
	path.get.responses['200'].content['application/json'] = {};
	path.get.responses['200'].content['application/json'].schema = {};
	path.get.responses['200'].content['application/json'].schema.$ref = '#/components/schemas/nitro';
	path.get.responses['200'].content['application/xml'] = clone(path.get.responses['200'].content['application/json']);

	path.get.responses.default = {};
	path.get.responses.default.description = 'Unexpected error';
	path.get.responses.default.content = {};
	path.get.responses.default.content['application/json'] = {};
	path.get.responses.default.content['application/json'].schema = {};
	path.get.responses.default.content['application/json'].schema.$ref = '#/components/schemas/ErrorModel';
	path.get.responses.default.content['application/xml'] = clone(path.get.responses.default.content['application/json']);

	if (feed.release_status == 'deprecated') {
		path.get.deprecated = true;
		console.log('! Warning, feed '+feed.name+' is '+feed.release_status+deprecationInfo(feed,feed.name,'feed',feed.deprecated_since))
	}

	if (feed.sorts) {
		feed.sorts.sort = toArray(feed.sorts.sort);
		if (feed.sorts.sort instanceof Array) {
			for (var i in feed.sorts.sort) {
				var sort = feed.sorts.sort[i];
				var sortName = ('s-'+feed.name+'-'+sort.name).toCamelCase();
				processSort(feed,sort,sortName);
			}
		}
	}

	if (feed.mixins) {
		feed.mixins.mixin = toArray(feed.mixins.mixin);
		for (var i in feed.mixins.mixin) {
			var mixin = feed.mixins.mixin[i];
			var mixinName = ('m-'+feed.name+'-'+mixin.name).toCamelCase();
			processMixin(feed,mixin,mixinName,true);
		}
		if (feed.mixins.unstable_mixins) {
			feed.mixins.unstable_mixins.mixin = toArray(feed.mixins.unstable_mixins.mixin);
			for (var i in feed.mixins.unstable_mixins.mixin) {
				var mixin = feed.mixins.unstable_mixins.mixin[i];
				var mixinName = ('m-'+feed.name+'-'+mixin.name).toCamelCase();
				processMixin(feed,mixin,mixinName,false);
			}
		}
	}

	if (feed.filters) {
		feed.filters.filter = toArray(feed.filters.filter);
		for (var i in feed.filters.filter) {
			var filter = feed.filters.filter[i];
			var filterName = ('f-'+feed.name+'-'+filter.name).toCamelCase();
			processFilter(feed,filter,filterName);
		}
	}

	additionalParameters(feed.name);

}
1017884
public function linkToPageRSSFeed()
    {
        if (!Config::inst()->get(VersionFeed::class, 'changes_enabled') || !$this->owner->PublicHistory) {
            return;
        }
        
        RSSFeed::linkToFeed(
            $this->owner->Link('changes'),
            _t(
                'SilverStripe\\VersionFeed\\VersionFeed.SINGLEPAGEFEEDTITLE',
                'Updates to {title} page',
                ['title' => $this->owner->Title]
            )
        );
    }
1052818
def _format(self, posts):
        
        if posts.__class__ == Post:
            # format a single post
            return posts.dict()
        formated_posts = []
        for post in posts:
            formated_posts.append(post.dict())
        return formated_posts
846683
private function get_address_to_blog_map() {
            $sites = self::get_sites();

            // Map site addresses to their blog IDs.
            $address_to_blog_map = array();
            foreach ( $sites as $site ) {
                $blog_id                         = self::get_site_blog_id( $site );
                $address                         = trailingslashit( fs_strip_url_protocol( get_site_url( $blog_id ) ) );
                $address_to_blog_map[ $address ] = $blog_id;
            }

            return $address_to_blog_map;
        }
171617
def get_feed_posts(self) -> Iterator[Post]:
        

        data = self.context.graphql_query("d6f4427fbe92d846298cf93df0b937d3", {})["data"]

        while True:
            feed = data["user"]["edge_web_feed_timeline"]
            yield from (Post(self.context, edge["node"]) for edge in feed["edges"]
                        if not edge["node"]["__typename"] == "GraphSuggestedUserFeedUnit")
            if not feed["page_info"]["has_next_page"]:
                break
            data = self.context.graphql_query("d6f4427fbe92d846298cf93df0b937d3",
                                              {'fetch_media_item_count': 12,
                                               'fetch_media_item_cursor': feed["page_info"]["end_cursor"],
                                               'fetch_comment_count': 4,
                                               'fetch_like': 10,
                                               'has_stories': False})["data"]
469201
def parse_feeds(self, message_channel=True):
        
        if parse:
            for feed_url in self.feeds:
                feed = parse(feed_url)
                for item in feed.entries:
                    if item["id"] not in self.feed_items:
                        self.feed_items.add(item["id"])
                        if message_channel:
                            message = self.format_item_message(feed, item)
                            self.message_channel(message)
                            return
247711
public function rss()
    {
        $posts = Content::post()->latestPublish()->limit(config('orchestra/story::per_page', 10))->get();

        return Response::view('orchestra/story::atom', ['posts' => $posts], 200, [
            'Content-Type' => 'application/rss+xml; charset=UTF-8',
        ]);
    }
118980
def build_rss_feed(podcast):
    
    if not os.path.exists(podcast.output_path):
        os.makedirs(podcast.output_path)

    rss = ET.Element('rss', attrib={'xmlns:itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd', 'version': '2.0'})

    channel = ET.SubElement(rss, 'channel')
    ET.SubElement(channel, 'title').text = podcast.title
    ET.SubElement(channel, 'link').text = podcast.link
    ET.SubElement(channel, 'copyright').text = podcast.copyright
    ET.SubElement(channel, 'itunes:subtitle').text = podcast.subtitle
    ET.SubElement(channel, 'itunes:author').text = podcast.author
    ET.SubElement(channel, 'itunes:summary').text = podcast.description
    ET.SubElement(channel, 'description').text = podcast.description

    owner = ET.SubElement(channel, 'itunes:owner')
    ET.SubElement(owner, 'itunes:name').text = podcast.owner_name
    ET.SubElement(owner, 'itunes:email').text = podcast.owner_email

    ET.SubElement(channel, 'itunes:image').text = podcast.image

    for category in podcast.categories:
        ET.SubElement(channel, 'itunes:category').text = category

    for episode in sorted(podcast.episodes.values(), key=lambda x: x.publish_date):
        if episode.published is True:
            item = ET.SubElement(channel, 'item')
            ET.SubElement(item, 'title').text = episode.title
            ET.SubElement(item, 'author').text = episode.author
            ET.SubElement(item, 'summary').text = episode.summary
            ET.SubElement(item, 'enclosure', attrib={'url': podcast.link + '/' + episode.link, 'length': str(episode.length), 'type': 'audio/x-mp3'})
            ET.SubElement(item, 'guid').text = podcast.link + '/' + episode.link
            ET.SubElement(item, 'pubDate').text = episode.publish_date.strftime('%a, %d %b %Y %H:%M:%S UTC')
            ET.SubElement(item, 'itunes:duration').text = episode.duration

    tree = ET.ElementTree(rss)
    with open(podcast.output_path + '/feed.xml', 'wb') as feed:
        tree.write(feed)
1142175
def blog__sync_db_post_field(post, db_post_field)
      post_fields = CONFIGS[:lato_blog][:post_fields]
      # search db post field on config file
      content = post_fields[db_post_field.key]
      db_post_field.update(meta_visible: false) && return unless content
      # check category of post field is accepted
      if content[:categories] && !content[:categories].empty?
        db_categories = LatoBlog::Category.where(meta_permalink: content[:categories])
        db_post_field.update(meta_visible: false) && return if (post.categories.pluck(:id) & db_categories.pluck(:id)).empty?
      end
    end
1249495
function feed_links( $args = array() ) {
		if ( !current_theme_supports('automatic-feed-links') )
			return;
		$defaults = array(
			/* translators: Separator between blog name and feed type in feed links */
			'separator'	=> _x('&raquo;', 'feed link'),
			/* translators: 1: blog title, 2: separator (raquo) */
			'feedtitle'	=> __('%1$s %2$s Feed'),
		);
		$args = wp_parse_args( $args, $defaults );
		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
	}