[videofy.me] Made requested changes

This commit is contained in:
Petar Kukolj 2018-10-04 21:17:46 +02:00
parent c443152757
commit 89db5af0fa

View File

@ -1,13 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import json
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
parse_iso8601,
clean_html, clean_html,
get_element_by_attribute,
) )
@ -50,20 +46,19 @@ class VideofyMeIE(InfoExtractor):
page = self._download_webpage(url, video_id) page = self._download_webpage(url, video_id)
video_info = json.loads(get_element_by_attribute('type', 'application/ld+json', page)) video_info = self._search_json_ld(page, video_id)
meta = self._download_json('https://www.videofy.me/wp-json/wp/v2/posts/%s' % video_id, video_id) uploader_id = self._download_json('https://www.videofy.me/wp-json/wp/v2/posts/%s' % video_id, video_id, fatal=False).get('author')
uploader_id = meta.get('author')
uploader_name = self._download_json('https://www.videofy.me/wp-json/wp/v2/users/%s' % uploader_id, uploader_id, fatal=False).get('name') uploader_name = self._download_json('https://www.videofy.me/wp-json/wp/v2/users/%s' % uploader_id, uploader_id, fatal=False).get('name')
return { return {
'id': video_id, 'id': video_id,
'title': video_info['name'], 'title': video_info['title'],
'url': video_info['contentUrl'], 'url': video_info['url'],
'thumbnail': video_info.get('thumbnailUrl'), 'thumbnail': video_info.get('thumbnail'),
'description': clean_html(video_info.get('description')), 'description': clean_html(video_info.get('description')),
'timestamp': parse_iso8601(video_info.get('uploadDate')), 'timestamp': video_info.get('timestamp'),
'uploader_id': uploader_id, 'uploader_id': uploader_id,
'uploader': uploader_name, 'uploader': uploader_name,
'view_count': int_or_none(video_info.get('interactionCount')), 'view_count': int_or_none(video_info.get('view_count')),
} }