mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-22 10:11:52 +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
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import urlencode_postdata
|
from ..utils import urlencode_postdata, try_get
|
||||||
|
|
||||||
|
|
||||||
class SexuIE(InfoExtractor):
|
class SexuIE(InfoExtractor):
|
||||||
|
@ -28,15 +28,15 @@ class SexuIE(InfoExtractor):
|
||||||
|
|
||||||
apiresponse = self._download_json(
|
apiresponse = self._download_json(
|
||||||
'https://sexu.com/api/video-info',
|
'https://sexu.com/api/video-info',
|
||||||
video_id, data=urlencode_postdata({'videoId': video_id})
|
video_id, data=urlencode_postdata({'videoId': video_id}))
|
||||||
)
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': source.get('src'),
|
'url': source.get('src'),
|
||||||
'format_id': source.get('type'),
|
'format_id': source.get('type'),
|
||||||
'height': int(self._search_regex(
|
'height': int(self._search_regex(
|
||||||
r'^(\d+)[pP]', source.get('quality', ''), 'height',
|
r'^(\d+)[pP]', source.get('quality', ''), 'height',
|
||||||
default=None)),
|
default=None)),
|
||||||
} for source in apiresponse['sources']]
|
} for source in try_get(apiresponse, lambda x: x['sources'])]
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
title = self._og_search_property('title', webpage)
|
title = self._og_search_property('title', webpage)
|
||||||
|
@ -47,8 +47,7 @@ class SexuIE(InfoExtractor):
|
||||||
thumbnail = self._og_search_property('image', webpage)
|
thumbnail = self._og_search_property('image', webpage)
|
||||||
|
|
||||||
categories = re.findall(
|
categories = re.findall(
|
||||||
r'(?s)<a class=[\'"]player-tags__item[\'"][^>]*>(.*?)</a>', webpage
|
r'(?s)<a[^>]+class=[\'"]player-tags__item[^>]*>([^<]+)</a>', webpage)
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
Loading…
Reference in a new issue