]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cracked.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from .youtube
import YoutubeIE
13 class CrackedIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?cracked\.com/video_(?P<id>\d+)_[\da-z-]+\.html'
16 'url': 'http://www.cracked.com/video_19070_if-animal-actors-got-e21-true-hollywood-stories.html',
17 'md5': '89b90b9824e3806ca95072c4d78f13f7',
21 'title': 'If Animal Actors Got E! True Hollywood Stories',
22 'timestamp': 1404954000,
23 'upload_date': '20140710',
27 'url': 'http://www.cracked.com/video_19006_4-plot-holes-you-didnt-notice-in-your-favorite-movies.html',
28 'md5': 'ccd52866b50bde63a6ef3b35016ba8c7',
32 'title': "4 Plot Holes You Didn't Notice in Your Favorite Movies - The Spit Take",
33 'description': 'md5:c603708c718b796fe6079e2b3351ffc7',
34 'upload_date': '20140725',
35 'uploader_id': 'Cracked',
36 'uploader': 'Cracked',
40 def _real_extract(self
, url
):
41 video_id
= self
._match
_id
(url
)
43 webpage
= self
._download
_webpage
(url
, video_id
)
45 youtube_url
= YoutubeIE
._extract
_url
(webpage
)
47 return self
.url_result(youtube_url
, ie
=YoutubeIE
.ie_key())
49 video_url
= self
._html
_search
_regex
(
50 [r
'var\s+CK_vidSrc\s*=\s*"([^"]+)"', r
'<video\s+src="([^"]+)"'],
53 title
= self
._search
_regex
(
54 [r
'property="?og:title"?\s+content="([^"]+)"', r
'class="?title"?>([^<]+)'],
57 description
= self
._search
_regex
(
58 r
'name="?(?:og:)?description"?\s+content="([^"]+)"',
59 webpage
, 'description', default
=None)
61 timestamp
= self
._html
_search
_regex
(
62 r
'"date"\s*:\s*"([^"]+)"', webpage
, 'upload date', fatal
=False)
64 timestamp
= parse_iso8601(timestamp
[:-6])
66 view_count
= str_to_int(self
._html
_search
_regex
(
67 r
'<span\s+class="?views"? id="?viewCounts"?>([\d,\.]+) Views</span>',
68 webpage
, 'view count', fatal
=False))
69 comment_count
= str_to_int(self
._html
_search
_regex
(
70 r
'<span\s+id="?commentCounts"?>([\d,\.]+)</span>',
71 webpage
, 'comment count', fatal
=False))
73 m
= re
.search(r
'_(?P<width>\d+)X(?P<height>\d+)\.mp4$', video_url
)
75 width
= int(m
.group('width'))
76 height
= int(m
.group('height'))
84 'description': description
,
85 'timestamp': timestamp
,
86 'view_count': view_count
,
87 'comment_count': comment_count
,