Difficulty understanding results
Trying to use this to get a query of all movies and shows available on Netflix in the US but cannot figure out how to output or read data. Lemme know if you can help
Hi gweinz I'd say if you have a look through at some of the attachments to the existing issues and pull requests there'll be enough to get you started. If you can follow the starting HowTo on the front page, that shows you how to set up with country = US and then do a call requesting content from netflix. That will give you back a python dictionary and the main bulk of data is in a list under the items key. Something like
for this_item in results['items']:
will get you started on iterating through it.
The less helpful part is that some of the data you call the api with (e.g. nfx for netflix) has numeric values in the results. If you have a look at the attachment to pull request #9 , you'll find example calls and results for the provider names & codes, genre details and a sample call for a movie and a series.
There's some further discussion on getting series data back in issue #13 which came before some functionality was added. Main starting point though is doing a .get_title() and then extracting the season id from that. You then pass the season id in a .get_season() call.
Last - if you are trying to get lots of results back at once look at pull request #6. There's an example there of how the paging works and how you can loop through.
Hi - thought I'd reply here rather than under pull request #6 Is this enough to get you started? I found that once I was getting something back then it was ok to start pulling together working code.
from justwatch import JustWatch
jw = JustWatch(country='US')
genres = jw.get_genres()
providers = jw.get_providers()
results = jw.search_for_item(genres=['cmy'], providers=['nfx'], page=1,page_size=20)
for i in range(1, results['total_pages']+1):
results = results = jw.search_for_item(genres=['cmy'], providers=['nfx'], page=i,page_size=20)
for this_result in results['items']:
print(this_result['title'])
You need to call search_for_item() with the short name for the genre and provider as a list even if you only have one item. You can find out what they are based on the results from get_genres() and get_providers(). You'll also get better results if you do the initial call specifying a specific page size. E.g. 20 in the code above. You can then iterate through calls for each page number in turn up to the initial maximum you get.
This will give you back just under 1500 results covering both movie and series, and print out the titles. You only get some results back in these calls - if you want more detail you'd then need to do further calls to .get_title(title_id=x) where x is the value from the id key.