简体   繁体   English

使用Flickr API

[英]Using the Flickr API

So I'm using the Flickr API. 所以我正在使用Flickr API。 I want to show the username of the person who took the picture, looks like this nobody@flickr.com (theNameOfTheUser). 我想显示拍摄照片的人的用户名,看起来像这个nobody@flickr.com(theNameOfTheUser)。

The thing is that I just want to show the actual username and exclude the e-mail. 事实是,我只想显示实际的用户名并排除电子邮件。 How can I do that? 我怎样才能做到这一点?

www.johancarleborn.se to see what I mean. www.johancarleborn.se明白我的意思。

newPic.innerHTML = "<div class='pic-container'> <p class='title'>" + result.items[i].title + "</p> <a href="+ result.items[i].link +" >  <img src=\'" + result.items[i].media.m + "\'> </a></div><p class='author'>" + result.items[i].author[19] + "</p><p class='published'>" + result.items[i].published + "</p>";

您可以使用Regexp,如下所示:

result.items[i].author[19].match(/\(([^)]*)\)/)[1]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM