Browse Source

#20

feature/020
みてるぞ 2 weeks ago
parent
commit
0ddf29cfd8
1 changed files with 10 additions and 9 deletions
  1. +10
    -9
      update_db.py

+ 10
- 9
update_db.py View File

@@ -358,18 +358,19 @@ def search_nico_by_tags (
if video.code in result_by_video_code: if video.code in result_by_video_code:
continue continue
try: 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'), 'userId': owner.get ('id'),
'title': video['title'],
'title': video_info['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['description'],
'viewCounter': video['count']['view'],
'startTime': video['registeredAt'] }
'description': video_info['description'],
'viewCounter': video_info['count']['view'],
'startTime': video_info['registeredAt'] }
except (KeyError, except (KeyError,
TypeError, TypeError,
ValueError, ValueError,


Loading…
Cancel
Save