0

I want to get the info for a specific season and episode using PowerShell:

$Movies = Invoke-RestMethod "http://www.omdbapi.com/?apikey=$key&s=The Last Ship&season=2&episode=12"# &season=2&episode=2
$Movies.totalResults
$movies.Search | where-object {$_.Type -eq "series"}

This just gives the generic show info. I would like to get Season 2/Episode 2, what kind of format does the query need to be?

bahrep
  • 29,961
  • 12
  • 103
  • 150
Paul
  • 3
  • 2
  • Welcome to SO! Can you please fix the formatting of your post? You can see [/editing-help](https://stackoverflow.com/editing-help) for help on how to do so. – starball Jan 01 '23 at 23:52
  • did I format the question correctly? – Paul Jan 02 '23 at 02:32
  • Better, but why did you take out what you tried? There wasn't anything wrong with saying what you tried, and actually some people here like seeing any attempts to solve the problem. – starball Jan 02 '23 at 02:52
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 02 '23 at 16:15
  • I know the Title, Season and Episode of a show. Using Powershell how would I structure the query to get the specific IMDB.id for that show? – Paul Jan 03 '23 at 00:05

1 Answers1

0

I don't think this question is PowerShell-specific, but omdbapi-specific. I think that you need to use the By ID or Title search type and specify the IMDB ID of the series and the IMDB ID. And perhaps the data about this particular series (The Last Ship) is missing from omdbapi.

Perhaps OMDB API is missing information about these series and episodes? I see open tickets regarding missing information on series like this one https://github.com/omdbapi/OMDb-API/issues/15.

For instance, I get results when I use the following URL (for ID tt0137330 episode 4):

Invoke-RestMethod "http://www.omdbapi.com/?apikey=$key&i=tt0137330&season=1&Episode=4"

Title      : Two Guys, a Girl and a Celtic Game
Year       : 1998
Rated      : N/A
Released   : 01 Apr 1998
Season     : 1
Episode    : 4
Runtime    : 22 min
Genre      : Comedy, Romance
Director   : John Fortenberry
Writer     : Rick Wiener, Kenny Schwartz, Danny Jacobson
Actors     : Traylor Howard, Ryan Reynolds, Richard Ruccolo
Plot       : Pete is very eager to go to a Celtics game with Sharon and Melissa. Berg is not so keen 
             to go. Despite this, Berg is in the lucky seat that gets him a seat on the bench, which 
             upsets Pete. What can Berg do to make him happy again?
Language   : English
Country    : United States
Awards     : N/A
Poster     : https://m.media-amazon.com/images/M/MV5BZDFkYmJjMDQtMjE1Zi00MGU1LWE0NTEtNjE5ZTMwY2IyYWQ1Xk
             EyXkFqcGdeQXVyNzA2NzkwNTA@._V1_SX300.jpg
Ratings    : {}
Metascore  : N/A
imdbRating : N/A
imdbVotes  : 401
imdbID     : tt0735044
seriesID   : tt0137330
Type       : episode
Response   : True

The same IMDB ID, but episode 2 is not found:

Invoke-RestMethod "http://www.omdbapi.com/?apikey=$key&i=tt0137330&season=1&Episode=2"

Response Error
-------- -----
False    Series or episode not found!

And I don't get any results when I use these URLs (for other IMDB IDs tt8068860 or tt2402207):

tt8068860

Invoke-RestMethod "http://www.omdbapi.com/?apikey=$key&i=tt8068860&season=1"

tt2402207

Invoke-RestMethod "http://www.omdbapi.com/?apikey=$key&i=tt2402207&season=1"
bahrep
  • 29,961
  • 12
  • 103
  • 150