簡體   English   中英

如何從下面的URL獲取JSON響應

[英]how to get json response from the below url

我有一個Instagram網址( https://www.instagram.com/p/-vSJNUDKKD/?__a=1 )它返回json,但是當我嘗試使用http get請求調用該網址時,我正在獲取整個html正文我在哪里做錯了。

  public GetItems(url: string) {
    return this._http.get(url).map((response: Response) => response.json());
  }
  public downloadImage(url: string) {
    var myresult;
    this.GetItems(url + "?__a=1").subscribe((result) => {
      myresult = result;
      console.log(result);

    });

訂閱http服務時應該有一個可觀察的地方。我嘗試使用以下代碼。似乎對我來說很好

getme(url):Observable<any>{
return this.http.get(url)
  .map((res:Response)=>{
    return res.json();
  })

}

 this.http.getme("https://www.instagram.com/p/-vSJNUDKKD/?__a=1").subscribe(
        res=> {

            console.log(res);
        })

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM