mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 03:32:05 +00:00
[SEXU] Improve patterns and conventions
This commit is contained in:
parent
987fbde7da
commit
1be56a5500
1 changed files with 5 additions and 6 deletions
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
|||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import urlencode_postdata
|
||||
from ..utils import urlencode_postdata, try_get
|
||||
|
||||
|
||||
class SexuIE(InfoExtractor):
|
||||
|
@ -28,15 +28,15 @@ class SexuIE(InfoExtractor):
|
|||
|
||||
apiresponse = self._download_json(
|
||||
'https://sexu.com/api/video-info',
|
||||
video_id, data=urlencode_postdata({'videoId': video_id})
|
||||
)
|
||||
video_id, data=urlencode_postdata({'videoId': video_id}))
|
||||
|
||||
formats = [{
|
||||
'url': source.get('src'),
|
||||
'format_id': source.get('type'),
|
||||
'height': int(self._search_regex(
|
||||
r'^(\d+)[pP]', source.get('quality', ''), 'height',
|
||||
default=None)),
|
||||
} for source in apiresponse['sources']]
|
||||
} for source in try_get(apiresponse, lambda x: x['sources'])]
|
||||
self._sort_formats(formats)
|
||||
|
||||
title = self._og_search_property('title', webpage)
|
||||
|
@ -47,8 +47,7 @@ class SexuIE(InfoExtractor):
|
|||
thumbnail = self._og_search_property('image', webpage)
|
||||
|
||||
categories = re.findall(
|
||||
r'(?s)<a class=[\'"]player-tags__item[\'"][^>]*>(.*?)</a>', webpage
|
||||
)
|
||||
r'(?s)<a[^>]+class=[\'"]player-tags__item[^>]*>([^<]+)</a>', webpage)
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
|
|
Loading…
Reference in a new issue