0

phonegap アプリを開発しています。jQuery を使用して次の HTML コードを使用し、ハッシュタグ #beavercreek を付けた instagram の写真を表示しています。

<html>
<head>
<title>Instagram test</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<script src="instagramfeed.js"></script>
<div class="instagramfeed"></div>
</body>
</html>

また、これは instagramfeed.js アーカイブのコードです

$(function() {
$.ajax({
    type: "GET",
    dataType: "jsonp",
    cache: false,
    url: "https://api.instagram.com/v1/tags/beavercreek/media/recent/?access_token=ACCESS_TOKEN_NUMBER",
    success: function(data) {
        console.log(data);
        for (var i = 0; i < 15; i++) {
            var date = new Date(parseInt(data.data[i].created_time) * 1000);
                $(".instagramfeed").append("\
                    <img src='" + data.data[i].images.standard_resolution.url +"' />\
<div>"+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear()+"</div>\
<div><strong>"+data.data[i].user.username+"</strong> "+data.data[i].caption.text+"</div><br /><br />\
                ");
            date = null;
        }
    }
});
});

結果には、このハッシュタグ (beavercreek) を含む instagram の写真が表示されますが、既知のユーザー名からの写真は除外されます。誰でも私を助けることができますか?.

どうもありがとうございました。

4

1 に答える 1

0

同じ応答を受け取っても問題がなく、コードでそれをフィルタリングするだけなら、できるかもしれません

for (var i = 0; i < 15; i++) {
    if(data.data[i].user.username != YOUR_USERNAME) {
        var date = new Date(parseInt(data.data[i].created_time) * 1000);
            $(".instagramfeed").append("\
                <img src='" + data.data[i].images.standard_resolution.url +"' />\
<div>"+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear()+"</div>\
<div><strong>"+data.data[i].user.username+"</strong> "+data.data[i].caption.text+"</div><br /><br />\
            ");
        date = null;
    } 
}
于 2013-10-15T09:47:59.073 に答える