English 中文(简体)
缩略语
原标题:JS: Insert youtubelink=youtube info

:

$.get( http://gdata.youtube.com/feeds/api/videos/NWHfY_lvKIQ?v=2&alt=json , function(data) {
        var title = data.entry.title.$t;
        var description = data.entry.media$group.media$description.$t;
        var thumbnail = data.entry.media$group.media$thumbnail[0].url; // URL of the image

        alert (description);
                alert (title);
                        alert (thumbnail);
        // Use these variables somewhere
});

这份文字是一部特定的录像。

现在,我只想做同样的事情,但你会插入一个你的管线,然后发生这种情况。

e.g 您在。 http://www.you Programme.com/watch?v=G7YXn-lfHXc。 输入正常的<代码><input id=“youtem”类型=“text”>,然后向您发出这三份通知,其中附有您所插入的视频链接的说明、标题和斜线。

http://www.you Programme.com/watch?v=G7YXn-lfHXc” rel=“nofollow noretinger” http://www.you Programme.com/watch?v=G7YXn-lfHXc to this G7YXn-lfHXc, 然后插入该行的视频链接:

HE?v=2&alt=json ,Function(data){

还是? 请帮助我对我的系统的最后需要,感谢你。

最佳回答

UPDATED, 做了一些更多的鉴定,以避免重复错误数据(例如,错误的您的链接)

这将照顾你们。

你们可以把活动放在一个子或投入领域的“on”上。

<input type="text" name="youtube" id="youtube_url" />

<script>
$(document).ready(function(){
    $("#youtube_url").blur(function() {
            var url=$(this).val();
            //get the youtube video id
            regx = new RegExp("http://(www.)?youtube.com/(.*)v=([a-zA-Z0-9-]+)");
            var ytID = regx.exec(url);

            if(ytID!=null && ytID[3]!="") {
                $.get( http://gdata.youtube.com/feeds/api/videos/ +ytID[3]+ ?v=2&alt=json , function(data) {
                        if(data.entry != null) {                                                                         
                            var title = data.entry.title.$t;
                            var description = data.entry.media$group.media$description.$t;
                            var thumbnail = data.entry.media$group.media$thumbnail[0].url; // URL of the image

                            alert (description);
                            alert (title);
                            alert (thumbnail);
                        // Use these variables somewhere
                        }
                });
            }
    });                        
});
</script>
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签