diff --git a/update_db.py b/update_db.py index 4aec5ab..530d5ce 100644 --- a/update_db.py +++ b/update_db.py @@ -358,18 +358,19 @@ def search_nico_by_tags ( if video.code in result_by_video_code: continue try: - video_data = fetch_video_data (video.code)['data'] - owner = video_data.get ('owner') or { } - video = video_data['video'] - result_by_video_code[video.code] = { - 'contentId': video.code, + tracked_video = video + video_data = fetch_video_data (tracked_video.code)['data'] + owner = video_data.get ('owner') or {} + video_info = video_data['video'] + result_by_video_code[tracked_video.code] = { + 'contentId': tracked_video.code, 'userId': owner.get ('id'), - 'title': video['title'], + 'title': video_info['title'], 'tags': ' '.join (map (lambda t: t['name'], video_data['tag']['items'])), - 'description': video['description'], - 'viewCounter': video['count']['view'], - 'startTime': video['registeredAt'] } + 'description': video_info['description'], + 'viewCounter': video_info['count']['view'], + 'startTime': video_info['registeredAt'] } except (KeyError, TypeError, ValueError,