1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 03:32:05 +00:00

Made some changes to conform with coding conventions

This commit is contained in:
JChris246 2020-06-30 20:13:54 -04:00
parent fe168c63bb
commit f17bcef192

View file

@ -6,6 +6,8 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
determine_ext, determine_ext,
float_or_none,
int_or_none,
js_to_json, js_to_json,
) )
@ -32,15 +34,15 @@ class SexLikeRealIE(InfoExtractor):
display_id = mobj.group('display_id') display_id = mobj.group('display_id')
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
# TODO more code goes here, for example ...
video_data = self._parse_json( video_data = self._parse_json(
self._search_regex( self._search_regex(
r'window\.vrPlayerSettings\s*=\s*({[^;]+});', r'window\.vrPlayerSettings\s*=\s*({[^;]+});',
webpage, 'video_data'), webpage, 'video_data'
video_id, transform_source=js_to_json)["videoData"] ), video_id, transform_source=js_to_json
)["videoData"]
title = video_data.get("title") title = (video_data["title"] or (self._html_search_meta('twitter:title',
webpage, 'description')).split('-')[0].strip())
formats = [] formats = []
for quality in video_data['src']: for quality in video_data['src']:
@ -50,12 +52,15 @@ class SexLikeRealIE(InfoExtractor):
'format_id': quality['quality'] 'format_id': quality['quality']
}) })
like_count = int_or_none(video_data.get('likes'))
duration = float_or_none(video_data.get('duration'))
return { return {
'id': video_id, 'id': video_id,
'display_id': display_id, 'display_id': display_id,
'title': title, 'title': title,
'thumbnail': video_data.get('posterURL'), 'thumbnail': video_data.get('posterURL'),
'like_count': video_data.get('likes'), 'like_count': like_count,
'duration': video_data.get('duration'), 'duration': duration,
'formats': formats, 'formats': formats,
} }