mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-29 05:32:00 +00:00
[videofy.me] Fixing extractor to work after site redesign
This commit is contained in:
parent
05e7c184da
commit
a6246c1f5b
1 changed files with 46 additions and 26 deletions
|
@ -1,9 +1,16 @@
|
||||||
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,
|
parse_iso8601,
|
||||||
|
unescapeHTML,
|
||||||
|
sanitize_url,
|
||||||
|
clean_html,
|
||||||
|
get_element_by_attribute,
|
||||||
|
js_to_json,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,42 +18,55 @@ class VideofyMeIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.videofy\.me/.+?|p\.videofy\.me/v)/(?P<id>\d+)(&|#|$)'
|
_VALID_URL = r'https?://(?:www\.videofy\.me/.+?|p\.videofy\.me/v)/(?P<id>\d+)(&|#|$)'
|
||||||
IE_NAME = 'videofy.me'
|
IE_NAME = 'videofy.me'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://www.videofy.me/thisisvideofyme/1100701',
|
'url': 'https://www.videofy.me/v/24582',
|
||||||
'md5': 'c77d700bdc16ae2e9f3c26019bd96143',
|
'md5': '1e46140bacdae8959827903cecd054d9',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1100701',
|
'id': '24582',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'This is VideofyMe',
|
'title': 'The VideofyMe app demo!',
|
||||||
'description': '',
|
'description': 'This is VideofyMe.',
|
||||||
'upload_date': '20130326',
|
'upload_date': '20120607',
|
||||||
'timestamp': 1364288959,
|
'timestamp': 1339070671,
|
||||||
'uploader': 'VideofyMe',
|
'uploader': 'oskarglauser',
|
||||||
'uploader_id': 'thisisvideofyme',
|
'uploader_id': 7010,
|
||||||
'view_count': int,
|
'view_count': int,
|
||||||
'likes': int,
|
|
||||||
'comment_count': int,
|
|
||||||
},
|
},
|
||||||
}
|
}, {
|
||||||
|
'url': 'https://www.videofy.me/v/2975905',
|
||||||
|
'md5': '79ad4498ab14dec72e815a8f85c7641c',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2975905',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'But',
|
||||||
|
'description': '',
|
||||||
|
'upload_date': '20180126',
|
||||||
|
'timestamp': 1516931131,
|
||||||
|
'uploader': 'iamatlien',
|
||||||
|
'uploader_id': 1798214,
|
||||||
|
'view_count': int,
|
||||||
|
},
|
||||||
|
},]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
config = self._download_json('http://vf-player-info-loader.herokuapp.com/%s.json' % video_id, video_id)['videoinfo']
|
page = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
video = config.get('video')
|
video_info = json.loads(get_element_by_attribute('type', 'application/ld+json', page))
|
||||||
blog = config.get('blog', {})
|
|
||||||
|
meta = self._download_json('https://www.videofy.me/wp-json/wp/v2/posts/%s' % video_id, video_id)
|
||||||
|
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')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video['title'],
|
'title': video_info['name'],
|
||||||
'url': video['sources']['source']['url'],
|
'url': video_info['contentUrl'],
|
||||||
'thumbnail': video.get('thumb'),
|
'thumbnail': video_info.get('thumbnailUrl'),
|
||||||
'description': video.get('description'),
|
'description': clean_html(video_info.get('description')),
|
||||||
'timestamp': parse_iso8601(video.get('date')),
|
'timestamp': parse_iso8601(video_info.get('uploadDate')),
|
||||||
'uploader': blog.get('name'),
|
'uploader_id': uploader_id,
|
||||||
'uploader_id': blog.get('identifier'),
|
'uploader': uploader_name,
|
||||||
'view_count': int_or_none(self._search_regex(r'([0-9]+)', video.get('views'), 'view count', fatal=False)),
|
'view_count': int_or_none(video_info.get('interactionCount')),
|
||||||
'likes': int_or_none(video.get('likes')),
|
|
||||||
'comment_count': int_or_none(video.get('nrOfComments')),
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue