@@ -581,85 +581,6 @@ def parse_video_list_ids_entry(self, id, entry):
581581 }
582582 }
583583
584- def parse_search_results (self , response_data ):
585- """Parse the list of search results, rip out the parts we need
586- and extend it with detailed show informations
587-
588- Parameters
589- ----------
590- response_data : :obj:`dict` of :obj:`str`
591- Parsed response JSON from the `fetch_search_results` call
592-
593- Returns
594- -------
595- :obj:`dict` of :obj:`dict` of :obj:`str`
596- Search results in the format:
597-
598- {
599- "70136140": {
600- "boxarts": "https://art-s.nflximg....jpg",
601- "detail_text": "Die legend\u00e4 re und...",
602- "id": "70136140",
603- "season_id": "70109435",
604- "synopsis": "Unter Befehl von...",
605- "title": "Star Trek",
606- "type": "show"
607- },
608- "70158329": {
609- "boxarts": ...
610- }
611- }
612- """
613- search_results = {}
614- raw_search_results = response_data .get ('value' , {}).get ('videos' , {})
615- for entry_id in raw_search_results :
616- if self ._is_size_key (key = entry_id ) is False :
617- # fetch information about each show & build up a
618- # proper search results dictionary
619- show = self .parse_show_list_entry (
620- id = entry_id ,
621- entry = raw_search_results .get (entry_id ))
622- #show_info = self.parse_show_information(
623- # id=entry_id,
624- # response_data=raw_search_results.get(entry_id))
625- #show[entry_id].update(show_info)
626- search_results .update (show )
627- return search_results
628-
629- def parse_show_list_entry (self , id , entry ):
630- """Parse a show entry e.g. rip out the parts we need
631-
632- Parameters
633- ----------
634- response_data : :obj:`dict` of :obj:`str`
635- Dictionary entry from the ´fetch_show_information´ call
636-
637- id : :obj:`str`
638- Unique id of the video list
639-
640- Returns
641- -------
642- entry : :obj:`dict` of :obj:`dict` of :obj:`str`
643- Show list entry in the format:
644-
645- {
646- "3589e2c6-ca3b-48b4-a72d-34f2c09ffbf4_11568382": {
647- "id": "3589e2c6-ca3b-48b4-a72d-34f2c09ffbf4_11568382",
648- "title": "Enterprise",
649- "boxarts": "https://art-s.nflximg.net/.../smth.jpg",
650- "type": "show"
651- }
652- }
653- """
654- return {
655- id : {
656- 'id' : id ,
657- 'title' : entry .get ('title' ),
658- 'boxarts' : entry ['boxarts' ]['_342x192' ]['jpg' ]['url' ],
659- 'type' : entry .get ('summary' , {}).get ('type' )
660- }
661- }
662-
663584 def parse_video_list (self , response_data ):
664585 """Parse a list of videos
665586
@@ -949,7 +870,7 @@ def parse_creators_for_video(self, video, persons):
949870 for person_key in dict (persons ).keys ():
950871 is_size_key = self ._is_size_key (key = person_key )
951872 if is_size_key is False and person_key != 'summary' :
952- for creator_key in dict (video [ 'creators' ] ).keys ():
873+ for creator_key in dict (video . get ( 'creators' , {}) ).keys ():
953874 is_size_key = self ._is_size_key (key = creator_key )
954875 if is_size_key is False and creator_key != 'summary' :
955876 if video ['creators' ][creator_key ][1 ] == person_key :
@@ -976,7 +897,7 @@ def parse_directors_for_video(self, video, persons):
976897 for person_key in dict (persons ).keys ():
977898 is_size_key = self ._is_size_key (key = person_key )
978899 if is_size_key is False and person_key != 'summary' :
979- for director_key in dict (video [ 'directors' ] ).keys ():
900+ for director_key in dict (video . get ( 'directors' , {}) ).keys ():
980901 is_size_key = self ._is_size_key (key = director_key )
981902 if is_size_key is False and director_key != 'summary' :
982903 if video ['directors' ][director_key ][1 ] == person_key :
@@ -1143,39 +1064,6 @@ def parse_netflix_list_id(self, video_list):
11431064 netflix_list_id = video_id
11441065 return netflix_list_id
11451066
1146- def parse_show_information (self , id , response_data ):
1147- """Parse extended show information (synopsis, seasons, etc.)
1148-
1149- Parameters
1150- ----------
1151- id : :obj:`str`
1152- Video id
1153-
1154- response_data : :obj:`dict` of :obj:`str`
1155- Parsed response JSON from the `fetch_show_information` call
1156-
1157- Returns
1158- -------
1159- entry : :obj:`dict` of :obj:`str`
1160- Show information in the format:
1161- {
1162- "season_id": "80113084",
1163- "synopsis": "Aus verzweifel..."
1164- "detail_text": "I´m optional"
1165- }
1166- """
1167- show = {}
1168- raw_show = response_data ['value' ]['videos' ][id ]
1169- show .update ({'synopsis' : raw_show ['regularSynopsis' ]})
1170-
1171- if 'evidence' in raw_show :
1172- evidence = raw_show .get ('evidence' , {}).get ('value' , {})
1173- show .update ({'detail_text' : evidence .get ('text' , '' )})
1174- if 'seasonList' in raw_show :
1175- season_list = raw_show .get ('seasonList' , {})
1176- show .update ({'season_id' : season_list .get ('current' , ['' , '' ])[1 ]})
1177- return show
1178-
11791067 def parse_seasons (self , id , response_data ):
11801068 """Parse a list of seasons for a given show
11811069
@@ -1485,7 +1373,6 @@ def fetch_search_results(self, search_str, list_from=0, list_to=48):
14851373 # reusable query items
14861374 item_path = ['search' , 'byTerm' , '|' + search_str ]
14871375 item_titles = ['titles' , list_to ]
1488- item_suggestions = ['suggestions' , list_to ]
14891376 item_pagination = [{'from' : list_from , 'to' : list_to }]
14901377
14911378 paths = [
@@ -1496,9 +1383,13 @@ def fetch_search_results(self, search_str, list_from=0, list_to=48):
14961383 item_path + item_titles + item_pagination + ['reference' , 'storyarts' , '_1632x873' , 'jpg' ],
14971384 item_path + item_titles + item_pagination + ['reference' , 'interestingMoment' , '_665x375' , 'jpg' ],
14981385 item_path + item_titles + item_pagination + ['reference' , 'artWorkByType' , 'BILLBOARD' , '_1280x720' , 'jpg' ],
1499- item_path + item_titles + [['referenceId' , 'id' , 'length' , 'name' , 'trackIds' , 'requestId' , 'regularSynopsis' , 'evidence' ]],
1500- item_path + item_suggestions + item_pagination + ['summary' , 'releaseYear' , 'title' , 'synopsis' , 'regularSynopsis' , 'evidence' , 'queue' , 'episodeCount' , 'info' , 'maturity' , 'runtime' , 'seasonCount' , 'releaseYear' , 'userRating' , 'numSeasonsLabel' , 'bookmarkPosition' , 'watched' , 'delivery' , 'seasonList' , 'current' ],
1501- item_path + item_suggestions + [['length' , 'referenceId' , 'trackId' ]]]
1386+ item_path + item_titles + item_pagination + ['reference' , 'cast' , {'from' : 0 , 'to' : 15 }, ['id' , 'name' ]],
1387+ item_path + item_titles + item_pagination + ['reference' , 'cast' , 'summary' ],
1388+ item_path + item_titles + item_pagination + ['reference' , 'genres' , {'from' : 0 , 'to' : 5 }, ['id' , 'name' ]],
1389+ item_path + item_titles + item_pagination + ['reference' , 'genres' , 'summary' ],
1390+ item_path + item_titles + item_pagination + ['reference' , 'tags' , {'from' : 0 , 'to' : 9 }, ['id' , 'name' ]],
1391+ item_path + item_titles + item_pagination + ['reference' , 'tags' , 'summary' ],
1392+ item_path + item_titles + [['referenceId' , 'id' , 'length' , 'name' , 'trackIds' , 'requestId' , 'regularSynopsis' , 'evidence' ]]]
15021393
15031394 response = self ._path_request (paths = paths )
15041395 return self ._process_response (
@@ -1551,44 +1442,6 @@ def fetch_video_list(self, list_id, list_from=0, list_to=None):
15511442 component = 'Video list' )
15521443 return processed_resp
15531444
1554- def fetch_video_list_information (self , video_ids ):
1555- """
1556- Fetches the JSON which contains the detail information of a
1557- list of given video ids
1558-
1559- Parameters
1560- ----------
1561- video_ids : :obj:`list` of :obj:`str`
1562- List of video ids to fetch detail data for
1563-
1564- Returns
1565- -------
1566- :obj:`dict` of :obj:`dict` of :obj:`str`
1567- Raw Netflix API call response or api call error
1568- """
1569- paths = []
1570- for video_id in video_ids :
1571- paths .append (['videos' , video_id , ['summary' , 'title' , 'synopsis' , 'regularSynopsis' , 'evidence' , 'queue' , 'episodeCount' , 'info' , 'maturity' , 'runtime' , 'seasonCount' , 'releaseYear' , 'userRating' , 'numSeasonsLabel' , 'bookmarkPosition' , 'watched' , 'delivery' ]])
1572- paths .append (['videos' , video_id , 'cast' , {'from' : 0 , 'to' : 15 }, ['id' , 'name' ]])
1573- paths .append (['videos' , video_id , 'cast' , 'summary' ])
1574- paths .append (['videos' , video_id , 'genres' , {'from' : 0 , 'to' : 5 }, ['id' , 'name' ]])
1575- paths .append (['videos' , video_id , 'genres' , 'summary' ])
1576- paths .append (['videos' , video_id , 'tags' , {'from' : 0 , 'to' : 9 }, ['id' , 'name' ]])
1577- paths .append (['videos' , video_id , 'tags' , 'summary' ])
1578- paths .append (['videos' , video_id , ['creators' , 'directors' ], {'from' : 0 , 'to' : 49 }, ['id' , 'name' ]])
1579- paths .append (['videos' , video_id , ['creators' , 'directors' ], 'summary' ])
1580- paths .append (['videos' , video_id , 'bb2OGLogo' , '_400x90' , 'png' ])
1581- paths .append (['videos' , video_id , 'boxarts' , '_342x192' , 'jpg' ])
1582- paths .append (['videos' , video_id , 'boxarts' , '_1280x720' , 'jpg' ])
1583- paths .append (['videos' , video_id , 'storyarts' , '_1632x873' , 'jpg' ])
1584- paths .append (['videos' , video_id , 'interestingMoment' , '_665x375' , 'jpg' ])
1585- paths .append (['videos' , video_id , 'artWorkByType' , 'BILLBOARD' , '_1280x720' , 'jpg' ])
1586-
1587- response = self ._path_request (paths = paths )
1588- return self ._process_response (
1589- response = response ,
1590- component = 'fetch_video_list_information' )
1591-
15921445 def fetch_metadata (self , id ):
15931446 """
15941447 Fetches the JSON which contains the metadata for a
@@ -1617,7 +1470,6 @@ def fetch_metadata(self, id):
16171470 response = response ,
16181471 component = self ._get_api_url_for (component = 'metadata' ))
16191472
1620- def fetch_show_information (self , id , type ):
16211473 """Fetches the JSON which contains the detailed contents of a show
16221474
16231475 Parameters
0 commit comments