changed to utils.parse_duration
changed to utils.parse_duration removed striping #
This commit is contained in:
parent
ea755fa9ee
commit
d279d07634
@ -1,5 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from youtube_dl import utils
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import urljoin
|
from ..utils import urljoin
|
||||||
|
|
||||||
@ -30,15 +32,6 @@ class YourPornIE(InfoExtractor):
|
|||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _parse_duration(self, s):
|
|
||||||
duration = 0
|
|
||||||
size = len(s.split(":"))
|
|
||||||
j = size - 1
|
|
||||||
for i in range(size):
|
|
||||||
duration += int(s.split(":")[i]) * (60 ** j)
|
|
||||||
j = j - 1
|
|
||||||
return duration
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
@ -53,15 +46,11 @@ class YourPornIE(InfoExtractor):
|
|||||||
title = (self._search_regex(
|
title = (self._search_regex(
|
||||||
r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title',
|
r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title',
|
||||||
default=None) or self._og_search_description(webpage)).strip()
|
default=None) or self._og_search_description(webpage)).strip()
|
||||||
if '#' in title:
|
|
||||||
title = title[0:title.index('#')].strip()
|
|
||||||
|
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
|
||||||
duration = self._parse_duration(self._search_regex(
|
duration = utils.parse_duration(self._search_regex(r'Video Info -> duration:<b>([0-9:]+)</b>',
|
||||||
r'Video Info -> duration:<b>([0-9:]+)</b>',
|
webpage, 'duration'))
|
||||||
webpage, 'duration'))
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user