| @@ -158,7 +158,7 @@ def update_tables ( | |||||
| video_tag.video_id = video.id | video_tag.video_id = video.id | ||||
| video_tag.tag_id = tag.id | video_tag.tag_id = tag.id | ||||
| video_tag.tagged_at = video_tag.tagged_at or today | |||||
| video_tag.tagged_at = getattr (video_tag, 'tagged_at', None) or today | |||||
| video_tag.untagged_at = None | video_tag.untagged_at = None | ||||
| video_tag.upsert () | video_tag.upsert () | ||||
| @@ -359,15 +359,17 @@ def search_nico_by_tags ( | |||||
| continue | continue | ||||
| try: | try: | ||||
| video_data = fetch_video_data (video.code)['data'] | video_data = fetch_video_data (video.code)['data'] | ||||
| owner = video_data.get ('owner') or { } | |||||
| video = video_data['video'] | |||||
| result_by_video_code[video.code] = { | result_by_video_code[video.code] = { | ||||
| 'contentId': video.code, | 'contentId': video.code, | ||||
| 'userId': video_data['video']['userId'], | |||||
| 'title': video_data['video']['title'], | |||||
| 'userId': owner.get ('id'), | |||||
| 'title': video['title'], | |||||
| 'tags': ' '.join (map (lambda t: t['name'], | 'tags': ' '.join (map (lambda t: t['name'], | ||||
| video_data['tag']['items'])), | video_data['tag']['items'])), | ||||
| 'description': video_data['video']['description'], | |||||
| 'viewCounter': video_data['video']['count']['view'], | |||||
| 'startTime': video_data['video']['registeredAt'] } | |||||
| 'description': video['description'], | |||||
| 'viewCounter': video['count']['view'], | |||||
| 'startTime': video['registeredAt'] } | |||||
| except (KeyError, | except (KeyError, | ||||
| TypeError, | TypeError, | ||||
| ValueError, | ValueError, | ||||