git://git.jankratochvil.net
/
youtube-dl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5a2ba45
)
Allow downloading current thedailyshow episode with youtube-dl :tds
author
Philipp Hagemeister
<phihag@phihag.de>
Tue, 13 Sep 2011 19:51:44 +0000
(21:51 +0200)
committer
Philipp Hagemeister
<phihag@phihag.de>
Tue, 13 Sep 2011 19:51:44 +0000
(21:51 +0200)
youtube-dl
patch
|
blob
|
history
diff --git
a/youtube-dl
b/youtube-dl
index
1b2ccae
..
9d379dc
100755
(executable)
--- a/
youtube-dl
+++ b/
youtube-dl
@@
-3037,9
+3037,9
@@
class MyVideoIE(InfoExtractor):
self._downloader.trouble(u'\nERROR: Unable to download video')
class ComedyCentralIE(InfoExtractor):
self._downloader.trouble(u'\nERROR: Unable to download video')
class ComedyCentralIE(InfoExtractor):
- """Information extractor for
blip.tv
"""
+ """Information extractor for
The Daily Show and Colbert Report
"""
- _VALID_URL = r'^(
?:https?://)?(www\.)?(thedailyshow|colbertnation)\.com/full-episodes/(
.*)$'
+ _VALID_URL = r'^(
:(?P<shortname>tds|thedailyshow|cr|colbert|colbertnation|colbertreport))|(https?://)?(www\.)(?P<showname>thedailyshow|colbertnation)\.com/full-episodes/(?P<episode>
.*)$'
@staticmethod
def suitable(url):
@staticmethod
def suitable(url):
@@
-3064,15
+3064,39
@@
class ComedyCentralIE(InfoExtractor):
if mobj is None:
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
return
if mobj is None:
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
return
- epTitle = mobj.group(3)
+
+ if mobj.group('shortname'):
+ if mobj.group('shortname') in ('tds', 'thedailyshow'):
+ url = 'http://www.thedailyshow.com/full-episodes/'
+ else:
+ url = 'http://www.colbertnation.com/full-episodes/'
+ mobj = re.match(self._VALID_URL, url)
+ assert mobj is not None
+
+ dlNewest = not mobj.group('episode')
+ if dlNewest:
+ epTitle = mobj.group('showname')
+ else:
+ epTitle = mobj.group('episode')
req = urllib2.Request(url)
self.report_extraction(epTitle)
try:
req = urllib2.Request(url)
self.report_extraction(epTitle)
try:
- html = urllib2.urlopen(req).read()
+ htmlHandle = urllib2.urlopen(req)
+ html = htmlHandle.read()
except (urllib2.URLError, httplib.HTTPException, socket.error), err:
self._downloader.trouble(u'ERROR: unable to download webpage: %s' % unicode(err))
return
except (urllib2.URLError, httplib.HTTPException, socket.error), err:
self._downloader.trouble(u'ERROR: unable to download webpage: %s' % unicode(err))
return
+ if dlNewest:
+ url = htmlHandle.geturl()
+ mobj = re.match(self._VALID_URL, url)
+ if mobj is None:
+ self._downloader.trouble(u'ERROR: Invalid redirected URL: ' + url)
+ return
+ if mobj.group('episode') == '':
+ self._downloader.trouble(u'ERROR: Redirected URL is still not specific: ' + url)
+ return
+ epTitle = mobj.group('episode')
mMovieParams = re.findall('<param name="movie" value="(http://media.mtvnservices.com/(.*?:episode:([^:]*):)(.*?))"/>', html)
if len(mMovieParams) == 0:
mMovieParams = re.findall('<param name="movie" value="(http://media.mtvnservices.com/(.*?:episode:([^:]*):)(.*?))"/>', html)
if len(mMovieParams) == 0: