- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试修改简单RSS阅读器以获取RSS中某个项目的Youtube视频ID来确定缩略图,我似乎处在正确的轨道上,但对于PHP来说却不是很好-这是来自helper.php,一旦完成就可以许多其他人使用它来为Joomla修改自己的Simple RSS Reader Mod。
我想知道如何使此函数“getYTid”将ID放在URL Veriable的末尾-代码在两个位置@函数中关闭,并且在末尾声明变量不仅是我要怎么做,但是如果可能的话,请把我带到一个我可以更好地理解使用混合文本声明变量的语法的地方,如果可能的话,我似乎经常遇到这个问题
function getYTid('$feed->itemLink') {
$ytvIDlen = 11; // This is the length of YouTube's video IDs
// The ID string starts after "v=", which is usually right after
// "youtube.com/watch?" in the URL
$idStarts = strpos($ytURL, "?v=");
// In case the "v=" is NOT right after the "?" (not likely, but I like to keep my
// bases covered), it will be after an "&":
if($idStarts === FALSE)
$idStarts = strpos($ytURL, "&v=");
// If still FALSE, URL doesn't have a vid ID
if($idStarts === FALSE)
die("YouTube video ID not found. Please double-check your URL.");
// Offset the start location to match the beginning of the ID string
$idStarts +=3;
// Get the ID string and return it
$ytvID = substr($ytURL, $idStarts, $ytvIDlen);
return $ytvID;
}
$feedItem->feedImageSrc = 'http://i3.ytimg.com/vi/'$ytvID'/default.jpg';
最佳答案
这是一个工作示例,您可以轻松调整它以使其适合您:
function get_yt_id($yturl, $idlen) {
$idchk_que = strpos($yturl, "?v=");
$idchk_amp = strpos($yturl, "&v=");
if ($idchk_que > -1 || $idchk_amp > -1) {
if ($idchk_que > -1) {
$yturl_exploded = explode("?v=", $yturl);
}
else if ($idchk_amp > -1) {
$yturl_exploded = explode("&v=", $yturl);
}
$yturl_exp = $yturl_exploded[1];
$ytid = substr($yturl_exp, 0, $idlen);
return $ytid;
}
else {
return "ID NOT FOUND";
}
}
$id_from_yturl = get_yt_id("http://www.youtube.com/watch?v=YvbQ9G0yXeU&t=14m36s", "11");
print $id_from_yturl;
关于php - Joomla-简单的RSS阅读器,可获取Youtube视频ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12645625/
我正在为现有网站创建 RSS,我只是想知道是否有推荐数量的提要项目显示在 RSS 提要中? 可以输出我想要的任意数量的提要吗?如果需要,一次像 50 个提要一样吗? RSS 的目的是让网站上的订阅者随
从 Windows 命令行,我希望能够发布到 RSS 提要。我想象这样的事情: rsspub @builds "Build completed without errors." 然后,有人可以访问我的
每当我在 RSS 提要中看到图像时,它们都嵌入在 CDATA 中,而不是被标签包围。 在我的提要中,我希望图像不这样做就显示出来。 无论是在浏览器中,还是在提要阅读器 (Bloglines) 中或通过
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be
RSS 项目内的描述标签是否有长度限制或最大大小? 此外,此标记是否可以容纳 HTML 标记? 我将生成 和来自同一源 HTML,还想知道 是否标签容纳 HTML。 最佳答案 据我所知,没有长度限制
我正在为我正在开发的网站创建 RSS 提要。我阅读了关于 RSS 的内容,它非常简单:它是一个特殊格式的 XML 文件。 但是,我找不到有关以下两个问题的信息 RSS 提要中的条目/项目数量是否有限制
对于我订阅的所有 RSS 源,我使用 Google Reader ,我喜欢。不过,我确实有几个特定的 RSS 提要,希望在更新后立即收到通知(例如,我希望尽快监控和响应的论坛的 RSS 提要)。
我了解如何制作 RSS 文件。它的 XML 非常简单。但是我需要什么特殊的更新才能分发,还是我只需要定期更新文件而其余的会自行处理?我在 rss 上找到的所有内容都在谈论它的作用,但并没有谈论它是如何
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 8年前关闭。 Improve this qu
是否有任何网站/服务可以让我向任何网站添加 RSS 订阅? 这是我工作的公司。我们有一个显示公司相关新闻的网站。这些新闻由外部机构提供,并自动更新到我们的数据库中。我们的网站选择随机/新消息并显示它们
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
我想知道在您的应用程序中使用其他人的 RSS 提要(例如 BBC RSS 提要)是否存在任何法律问题? 最佳答案 你真的应该问律师。但是,我在 out-law.com 上找到了这个: Using a
我们有一个提供一些 RSS 提要的站点,我们想知道有多少人订阅了每个提要,而不使用像 FeedBurner 这样的系统来为他们提供服务。 解决这个问题的原始方法基本上是记录请求,然后获取请求每个提要的
我有一个系统可以获取几百个 RSS 提要。目前,它们的刷新周期为 10 分钟,但我最好让它更快。以近实时/推送间隔获取 RSS 源的策略是什么? 我遇到的一些解决方案: 1分钟取一次;如果没有变化,则
我需要在数据库中存储来自多个 RSS 提要的新项目。我想使用每个项目的 GUID 标记来确定它是否已经存在于数据库中。 见 W3C specification : guid stands for gl
我正在构建一个在线 Rss 阅读器。我希望能够与文章标题和描述一起显示图像。 我正在使用谷歌提要 API 从 CNN ( http://rss.cnn.com/rss/edition.rss ) 读取
我订阅了许多 RSS 提要,主要来自我自己的时区(英国:目前是 GMT+1,又名 BST)。不过我也对新西兰的新闻感兴趣(目前为 GMT+12)。 我的问题是由于我沉迷于需要将未读计数保持在或接近于零
首先,为什么我问:现在 StackOverflow 上的声望点具有真正的值(value)(您可以通过提供赏金将它们花在该死的好答案上)我想监视我可能能够回答的问题并扑向它们! (此外,其他人实时回答我
我想基于我使用的Tumblr标签创建一个RSS feed。我想将的部分提交给博客联合服务。我必须向博客联合组织提供一个RSS feed。但是我不希望所有帖子都出现在那。有什么办法可以做这样的事情吗?
当我们用 rss 阅读器获取 rss 时,阅读器是标记已读/未读状态还是将此类信息发送回服务器? 阅读完一条消息后,我转向另一个 RSS 阅读器,我会收到所有标记为未读的 RSS 记录吗? 最佳答案
我是一名优秀的程序员,十分优秀!