diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py
index 466124d6e..a32c32b95 100644
--- a/youtube_dl/extractor/yourporn.py
+++ b/youtube_dl/extractor/yourporn.py
@@ -30,6 +30,15 @@ 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):
video_id = self._match_id(url)
@@ -47,18 +56,8 @@ class YourPornIE(InfoExtractor):
if '#' in title:
title = title[0:title.index('#')].strip()
thumbnail = self._og_search_thumbnail(webpage)
- duration_raw = self._search_regex(r'Video Info -> duration:([0-9:]+)',
- webpage, 'duration')
- if len(duration_raw.split(":")) == 3:
- duration = int((duration_raw.split(":")[0])) * 3600 + \
- int((duration_raw.split(":")[1])) * 60 + \
- int((duration_raw.split(":")[2]))
- elif len(duration_raw.split(":")) == 2:
- duration = int((duration_raw.split(":")[0])) * 60 + \
- int((duration_raw.split(":")[1]))
- else:
- duration = int((duration_raw.split(":")[1]))
-
+ duration = self._parse_duration(self._search_regex(r'Video Info -> duration:([0-9:]+)',
+ webpage, 'duration'))
return {
'id': video_id,
'url': video_url,