【问题标题】:How to access the Instagram API as a script not an app?如何以脚本而非应用程序的形式访问 Instagram API?
【发布时间】:2015-12-05 07:17:06
【问题描述】:

有很多关于如何创建应用程序和使用 OAuth 授权应用程序用户访问 Instagram 的文档……但我没有第三方用户。我只想编写对 API 的访问以获取数据,就像使用 Twitter 或 Reddit 一样。

我是否遗漏了一些明显的东西?

【问题讨论】:

    标签: api oauth instagram


    【解决方案1】:

    你可以这样使用。在这里,我从主题标签中获取所有数据。 访问link 了解更多信息。

    $(document).ready(function () {  
        var hashtag = 'dilwale'// My hash tag  
        var accessToken = '16741082.1b07669.121a338d0cbe4ff6a5e04543158a4f82' //Write your access token  
        $.ajax({  
            url: 'https://api.instagram.com/v1/tags/' + hashtag + '/media/recent?count=33&access_token='+ accessToken +'',  
            dataType: 'jsonp',  
            type: 'GET',  
            success: function (data) {  
                console.log(data);  
                for (x in data.data) {  
                    if (data.data[x].type == 'video') {  
                        //console.log("Video" + data.data[x].videos.standard_resolution.url);  
                        //See the browser console and add data as per requirements  
                        $('.instagram').append('<div style="border:1px solid orange"><video controls><source src="' + data.data[x].videos.standard_resolution.url + '" type="video/mp4"></video><span style="border:1px solid orange; dislay:block">Test1</span></div>');  
                    } else if (data.data[x].type == 'image') {  
                        $('.instagram').append('<div style="border:1px solid orange"><img src="' + data.data[x].images.standard_resolution.url + '" ><span style="border:1px solid orange; display:block">"' + data.data[x].caption.text + '"</span><span style="border:1px solid orange; dislay:block">Test1</span></div>');  
                        //console.log("Image");  
                        //See the browser console and add data as per requirements  
                    }  
                }  
            },  
            error: function (data) {  
                console.log(data);  
            }  
        })  
    }); 
    

    在小提琴Get latest images and videosfrom a hash tag中寻找解决方案

    【讨论】:

    • 您是如何在不使用 OAuth 和身份验证的情况下获得访问令牌的?
    • 我访问了 (pinceladasdaweb.com.br/instagram/access-token) 并点击了获取访问令牌。
    • 所以您确实使用了 OAuth 并且您确实进行了身份验证。不知道你不明白哪一部分。
    猜你喜欢
    • 2017-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-22
    • 2016-03-26
    • 1970-01-01
    • 2021-03-20
    • 2016-08-09
    相关资源
    最近更新 更多