instagram graphql在“边缘标签到媒体”中隐藏“计数”

wqsoz72f  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(176)

我正在寻找使用“?\uu a=1”instagram开放api的hashtag的posts计数。我在用java。我向端点发出get请求“https://www.instagram.com/explore/tags/cachorro/?__a=1,存储对jsonobject的响应,并按以下方式获取posts计数:

object.getJSONObject("graphql").getJSONObject("hashtag").getJSONObject("edge_hashtag_to_media").getInt("count")

在我的开发pc上执行代码时,我得到了正确的值:

{
   "count": 8546301,
   "page_info": {
      "has_next_page": true,
      "end_cursor": "QVFCVHpDLTR4RHNUMjVPN1FOQk03QXpKWWRwYnk3ZjZJek5uOEdfczNYcWJiOWtSU3VIbEtuUzMwN01KSDYwaGs1eWJ0WUVrSWVjR3RMeEFfTTB1S1NRQw=="
   }...

当代码在我的vps服务器上执行时,我得到一个空值:

{"count":0,"page_info":{"has_next_page":false,"end_cursor":null},"edges":[]}

我正在使用httpurlconnection和instagram需要的所有cookies:

HttpURLConnection con = (HttpURLConnection) url.openConnection();
InstagramCookieBuilder cookieBuilder = new InstagramCookieBuilder();
InstagramCookie cookie = cookieBuilder.igDid("HIDDEN")
                                            .mid("HIDDEN")
                                            .shbid("HIDDEN")
                                            .shbts("HIDDEN")
                                            .sessionId("HIDDEN")
                                            .rur("HIDDEN")
                                            .csrfToken("HIDDEN")
                                            .dsUserId("HIDDEN")
                                            .urlGen("\"{\"VPS_IP_ADDRESS\": HIDDEN\HIDDEN\"VPS_MAC_ADDRESS\": HIDDEN}:HIDDEN\"")
                                            .build();
String cookieString = cookie.toString();
con.setRequestProperty("Cookie", cookieString);

怎么了?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题