aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/cracked.py
diff options
context:
space:
mode:
authorhassaanaliw <hassaanaliw@gmail.com>2014-07-16 18:45:42 +0500
committerhassaanaliw <hassaanaliw@gmail.com>2014-07-16 18:45:42 +0500
commit43f0537c06384b9b97235a93ea39649ee3de4d45 (patch)
tree20da368c8eba42f88adcb3c2b64aa6a80289a104 /youtube_dl/extractor/cracked.py
parentbd1f325b427eaea944b4b01ef4ee7c3559caac5c (diff)
downloadyoutube-dl-43f0537c06384b9b97235a93ea39649ee3de4d45.zip
youtube-dl-43f0537c06384b9b97235a93ea39649ee3de4d45.tar.gz
youtube-dl-43f0537c06384b9b97235a93ea39649ee3de4d45.tar.bz2
[cracked] Add new extractor
Diffstat (limited to 'youtube_dl/extractor/cracked.py')
-rw-r--r--youtube_dl/extractor/cracked.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/youtube_dl/extractor/cracked.py b/youtube_dl/extractor/cracked.py
new file mode 100644
index 0000000..37c0f7f
--- /dev/null
+++ b/youtube_dl/extractor/cracked.py
@@ -0,0 +1,46 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+
+class CrackedIE(InfoExtractor):
+ _VALID_URL = r'http?://.*?\.cracked\.com/video_+(?P<id>.*)_.*'
+ _TEST = {
+ 'url': 'http://www.cracked.com/video_18803_4-social-criticisms-hidden-in-sonic-hedgehog-games.html',
+
+ 'info_dict': {
+ 'id': '18803',
+ 'ext': 'mp4',
+ 'title': "4 Social Criticisms Hidden in 'Sonic the Hedgehog' Games | Cracked.com",
+ 'height': 375,
+ 'width': 666,
+
+
+ }
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('id')
+
+ webpage = self._download_webpage(url, video_id)
+ title = self._search_regex(r'<title>(.*?)</title>',webpage,'title')
+ video_url = self._search_regex(r'var CK_vidSrc = "+(.*)"',webpage,'url')
+ width = self._search_regex(r'width="(.*?)"',webpage,'width')
+ height = re.findall(r'height="(.*?)"',webpage)[1]
+
+
+
+
+ return {
+ 'url':video_url,
+ 'id': video_id,
+ 'ext':'mp4',
+ 'title':title,
+ 'height':int(height),
+ 'width':int(width)
+
+
+ } \ No newline at end of file