使用imdb-api,当我打电话时,我没有收到任何东西

发布于 2025-01-24 01:47:06 字数 1276 浏览 1 评论 0原文

我正在使用IMDB Web API(

以下是我称为的API:

private void SearchForMovie()
{
        string hostURL = "https://imdb-api.com/eng/API/SearchMovie/" +apiKey+ "/" + Searchbar.Text;

        WebRequest wrGETURL;

        wrGETURL = WebRequest.Create(hostURL);

        Stream objStream;
        objStream = wrGETURL.GetResponse().GetResponseStream();

        StreamReader objReader = new StreamReader(objStream);

        string jsonData = objReader.ReadToEnd();

        searchData = JsonConvert.DeserializeObject<SearchData>(jsonData);

        

        MessageBox.Show(searchResult.Id);
}

这是网站上的.json文件我应该使用:

using System.Collections.Generic;

public class SearchData
{
  public string SearchType { get; set; }
  public string Expression { get; set; }

  public List<SearchResult> Results { get; set; }

  public string ErrorMessage { get; set; }
}

public class SearchResult
{
  public string Id { get; set; }
  public string ResultType { get; set; }
  public string Image { get; set; }
  public string Title { get; set; }
  public string Description { get; set; }
}

public enum SearchType
{
  Title = 1,
  Movie = 2,
  Series = 4,
  Name = 8,
  Episode = 16,
  Company = 32,
  Keyword = 64,
  All = 128
}

I am writing a program using the IMDB web api (https://imdb-api.com/) however when I am making a call with it I am not receiving any data back, I have reached out to them a few weeks ago but still not heard any response. The apiKey is correct and part of another function.

Below is the api I call I am making:

private void SearchForMovie()
{
        string hostURL = "https://imdb-api.com/eng/API/SearchMovie/" +apiKey+ "/" + Searchbar.Text;

        WebRequest wrGETURL;

        wrGETURL = WebRequest.Create(hostURL);

        Stream objStream;
        objStream = wrGETURL.GetResponse().GetResponseStream();

        StreamReader objReader = new StreamReader(objStream);

        string jsonData = objReader.ReadToEnd();

        searchData = JsonConvert.DeserializeObject<SearchData>(jsonData);

        

        MessageBox.Show(searchResult.Id);
}

And this is the .Json file that on there website said I should use:

using System.Collections.Generic;

public class SearchData
{
  public string SearchType { get; set; }
  public string Expression { get; set; }

  public List<SearchResult> Results { get; set; }

  public string ErrorMessage { get; set; }
}

public class SearchResult
{
  public string Id { get; set; }
  public string ResultType { get; set; }
  public string Image { get; set; }
  public string Title { get; set; }
  public string Description { get; set; }
}

public enum SearchType
{
  Title = 1,
  Movie = 2,
  Series = 4,
  Name = 8,
  Episode = 16,
  Company = 32,
  Keyword = 64,
  All = 128
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文