簡體   English   中英

為iTunes制作播客RSS源

[英]Making a podcast RSS feed for iTunes

我正在使用PHP構建RSS源,並希望它在iTunes中很好地顯示。

  • 如何格式化RSS源以便iTunes喜歡它?
  • 我應該使用哪些特殊標簽?
  • 將它提交到iTunes目錄的最佳方式是什么(只需一次,或定期重新提交以保持“新鮮”)?
  • 有哪些最佳實踐,提示和技巧可以使Feed在iTunes Store中顯眼?

RSS源的格式應與其他任何帶有機箱的格式相同。 網上有數百種資源描述了如何制作這樣的資料。

這里會告訴您RSS源中需要的iTunes特定標簽。

請注意,Apple已經嚴重破壞了iTunes 9中的播客支持,所以如果它看起來不能正常工作,請不要氣餒:這可能是Apple的錯。

我已為此創建了一個小型PHP庫,您可以在此處找到它。

這是一個例子:

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();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM