{"id":1825,"date":"2004-11-12T23:23:52","date_gmt":"2004-11-13T04:23:52","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=1825"},"modified":"2004-11-14T11:00:51","modified_gmt":"2004-11-14T16:00:51","slug":"an-rss-generator-for-cbc-channels","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2004\/11\/12\/an-rss-generator-for-cbc-channels\/","title":{"rendered":"An RSS generator for CBC Channels"},"content":{"rendered":"<p>This isn&#8217;t perfect (seems to fail on some feeds), but mostly works for me:<\/p>\n<p><code><br \/>\n#!\/usr\/bin\/perl -w<br \/>\n# cdf2rss - converts CBC KlipFarm CDF to crude RSS<br \/>\n# created by scruss on 02004\/11\/12<br \/>\n# RCS\/CVS: $Id: cdf2rss,v 1.3 2004\/11\/13 03:59:21 scruss Exp $<br \/>\n# takes one argument, a stream name. Currently known streams are:<br \/>\n#<br \/>\n#  Arts         Business    Calgary    Canada<br \/>\n#  Edmonton     Montreal    Ottawa<br \/>\n#  Science      Sports      Toronto<br \/>\n#  Vancouver    Winnipeg    World<br \/>\n#<br \/>\n# returns a crude RSS 1.0 stream fashioned from the CBC CDF output.<br \/>\nuse strict;<br \/>\nuse integer;<br \/>\nuse XML::Simple;<br \/>\nuse XML::RSS;<br \/>\nuse LWP::Simple;<br \/>\nuse constant CDFURL => 'http:\/\/www.cbc.ca\/cdf\/servlet\/getCDF';<br \/>\nmy $cdf = get( join( '?lineup=', CDFURL, $ENV{'QUERY_STRING'} ) );<br \/>\nmy $xs  = new XML::Simple;<br \/>\nmy $ref = $xs->XMLin($cdf);<br \/>\nmy $rss = new XML::RSS( version => '1.0' );<br \/>\n$rss->channel(<br \/>\n    title       => join( ' ', 'CBC', $ref->{category} ),<br \/>\n    description => join( ' ', 'CBC', $ref->{category} ),<br \/>\n    link        => $ref->{href}<br \/>\n);<br \/>\nforeach my $cdf_item ( @{ $ref->{item} } ) {<br \/>\n    my $tmp_abstract = $cdf_item->{abstract};<br \/>\n    $tmp_abstract =~ s\/&#092;s+\/ \/g;<br \/>\n    $tmp_abstract =~ s\/^ \/\/;<br \/>\n    $tmp_abstract =~ s\/ $\/\/;<br \/>\n    $rss->add_item(<br \/>\n        title       => $cdf_item->{title},<br \/>\n        link        => $cdf_item->{href},<br \/>\n        description => $tmp_abstract<br \/>\n    );<br \/>\n}<br \/>\nprint \"Content-type: application\/xml+rss&#092;n&#092;n\", $rss->as_string;<br \/>\nexit;<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This isn&#8217;t perfect (seems to fail on some feeds), but mostly works for me: #!\/usr\/bin\/perl -w # cdf2rss &#8211; converts CBC KlipFarm CDF to crude RSS # created by scruss on 02004\/11\/12 # RCS\/CVS: $Id: cdf2rss,v 1.3 2004\/11\/13 03:59:21 scruss Exp $ # takes one argument, a stream name. Currently known streams are: # # [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7,10],"tags":[1096,187,605],"class_list":["post-1825","post","type-post","status-publish","format-standard","hentry","category-computers-suck","category-o-canada","tag-cbc","tag-perl","tag-rss"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-tr","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/1825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=1825"}],"version-history":[{"count":0,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/1825\/revisions"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=1825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=1825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=1825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}