为iTunes制作播客RSS源

时间:2009-08-29 10:54:35

标签: php rss itunes feeds

我正在使用PHP构建RSS源,并希望它在iTunes中很好地显示。

  • 如何设置RSS Feed的格式以便iTunes喜欢它?
  • 我应该使用哪些特殊标签?
  • 将其提交到iTunes目录的最佳方式是什么(只需一次,或定期重新提交以保持“新鲜”)?
  • 有哪些最佳做法,提示和技巧可以使Feed在iTunes Store中突出显示?

2 个答案:

答案 0 :(得分:2)

RSS源应该像其他任何一个带有机箱的格式一样。网上有数百种资源描述了如何制作这样的资料。

here会告诉您RSS Feed中所需的iTunes专用标记。

请注意,Apple已经严重破坏了iTunes 9中的播客支持,所以如果它看起来不能正常工作,请不要气馁:这可能是Apple的错。

答案 1 :(得分:0)

我为此创建了一个小型PHP库,您可以找到它here

以下是一个例子:

use iTunesPodcastFeed\Channel;
use iTunesPodcastFeed\FeedGenerator;
use iTunesPodcastFeed\Item;

require __DIR__ . '/vendor/autoload.php';

// SETUP CHANNEL
$title = 'Read2Me Daily Curated Articles';
$link = 'https://read2me.online';
$author = 'NYTimes and Medium';
$email = 'hello@read2me.online';
$image = 'https://d22fip447qchhd.cloudfront.net/api/widget/static/images/default-thumbnail.png';
$explicit = false;
$categories = [
    'News',
    'Technology',
    'Culture',
    'Entrepreneurship',
    'Productivity'
];
$description = 'Daily curated articles from New York Times and Medium';
$lang = 'en';
$copyright = 'The New York Times Company and The Medium Company';
$ttl = 43200; // 12 hours in seconds

$channel = new Channel(
    $title, $link, $author, $email,
    $image, $explicit, $categories,
    $description, $lang, $copyright, $ttl
);

// SETUP EPISODE
$title = "Trump Says Disclosure of Mueller Questions in Russia Probe Is ‘Disgraceful’";
$fileUrl = 'https://s3.read2me.online/audio/www-nytimes-com-2018-05-01-us-politics-trump-mueller-russia-questions-html-7e9601.mp3';
$duration = '2:18';
$description = 'WASHINGTON — President Trump on Tuesday said it was “disgraceful” that questions the special counsel would like to ask him were publicly disclosed, and he incorrectly noted that there were no questions about collusion. The president also said collusion was a “phony” crime.';
$date = 1525177808;
$filesize = 828387;
$mime = 'audio/mpeg';

$item = new Item(
    $title, $fileUrl, $duration,
    $description, $date, $filesize, $mime
);
$item2 = clone $item; // just to give you an idea of how it works

// SETUP FEED
$feed = new FeedGenerator($channel, ...[$item, $item2]);

// OUTPUT XML
header('Content-Type: application/xml; charset=utf-8');

print $feed->getXml();