Browse Source

#20

feature/020
みてるぞ 2 weeks ago
parent
commit
af4cc8d618
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      update_db.py

+ 8
- 6
update_db.py View File

@@ -158,7 +158,7 @@ def update_tables (
video_tag.video_id = video.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.upsert ()

@@ -359,15 +359,17 @@ def search_nico_by_tags (
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,
'userId': video_data['video']['userId'],
'title': video_data['video']['title'],
'userId': owner.get ('id'),
'title': video['title'],
'tags': ' '.join (map (lambda t: t['name'],
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,
TypeError,
ValueError,


Loading…
Cancel
Save