[playfm] Fix view count and add comment count

This commit is contained in:
Sergey M․ 2014-09-22 18:58:22 +07:00
parent f90d95edeb
commit 273dea4248
1 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from ..utils import (
ExtractorError, ExtractorError,
float_or_none, float_or_none,
int_or_none, int_or_none,
str_to_int,
) )
@ -29,6 +30,7 @@ class PlayFMIE(InfoExtractor):
'duration': 5627.428, 'duration': 5627.428,
'upload_date': '20140712', 'upload_date': '20140712',
'view_count': int, 'view_count': int,
'comment_count': int,
'thumbnail': 're:^https?://.*\.jpg$', 'thumbnail': 're:^https?://.*\.jpg$',
}, },
} }
@ -51,7 +53,8 @@ class PlayFMIE(InfoExtractor):
recording = rec_doc.find('./recording') recording = rec_doc.find('./recording')
title = recording.find('./title').text title = recording.find('./title').text
view_count = int_or_none(recording.find('./stats/playcount').text) view_count = str_to_int(recording.find('./stats/playcount').text)
comment_count = str_to_int(recording.find('./stats/comments').text)
duration = float_or_none(recording.find('./duration').text, scale=1000) duration = float_or_none(recording.find('./duration').text, scale=1000)
thumbnail = recording.find('./image').text thumbnail = recording.find('./image').text
@ -75,6 +78,7 @@ class PlayFMIE(InfoExtractor):
'title': title, 'title': title,
'upload_date': upload_date, 'upload_date': upload_date,
'view_count': view_count, 'view_count': view_count,
'comment_count': comment_count,
'duration': duration, 'duration': duration,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'uploader': uploader, 'uploader': uploader,