aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-04-12 17:15:16 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-04-12 17:15:16 +0200
commit66398056f17d0a9c04861a98b6e95d70ab08a353 (patch)
treef1abed179de44ba7ff2570946fed14a34a5800ab /youtube_dl/extractor
parentb9c76aa1a9c80013ad4f2f3cd20b98ab1be430ac (diff)
parent77477fa4c916599e7eaa236a3f3eb5703923cf91 (diff)
downloadyoutube-dl-66398056f17d0a9c04861a98b6e95d70ab08a353.tar.xz
Merge branch 'master' of github.com:rg3/youtube-dl
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/brightcove.py6
-rw-r--r--youtube_dl/extractor/firstpost.py29
-rw-r--r--youtube_dl/extractor/prosiebensat1.py1
-rw-r--r--youtube_dl/extractor/weibo.py30
4 files changed, 40 insertions, 26 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py
index 339d60ff0..3c02c297a 100644
--- a/youtube_dl/extractor/brightcove.py
+++ b/youtube_dl/extractor/brightcove.py
@@ -140,7 +140,11 @@ class BrightcoveIE(InfoExtractor):
url_m = re.search(r'<meta\s+property="og:video"\s+content="(http://c.brightcove.com/[^"]+)"', webpage)
if url_m:
- return [unescapeHTML(url_m.group(1))]
+ url = unescapeHTML(url_m.group(1))
+ # Some sites don't add it, we can't download with this url, for example:
+ # http://www.ktvu.com/videos/news/raw-video-caltrain-releases-video-of-man-almost/vCTZdY/
+ if 'playerKey' in url:
+ return [url]
matches = re.findall(
r'''(?sx)<object
diff --git a/youtube_dl/extractor/firstpost.py b/youtube_dl/extractor/firstpost.py
index 7e3d1afd2..eccd8dde9 100644
--- a/youtube_dl/extractor/firstpost.py
+++ b/youtube_dl/extractor/firstpost.py
@@ -6,7 +6,6 @@ from .common import InfoExtractor
class FirstpostIE(InfoExtractor):
- IE_NAME = 'Firstpost.com'
_VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
_TEST = {
@@ -16,7 +15,6 @@ class FirstpostIE(InfoExtractor):
'id': '1025403',
'ext': 'mp4',
'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
- 'description': 'Its flight deck is over twice the size of a football field, its power unit can light up the entire Kochi city and the cabling is enough to cover the distance between here to Delhi.',
}
}
@@ -24,15 +22,26 @@ class FirstpostIE(InfoExtractor):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
- webpage = self._download_webpage(url, video_id)
- video_url = self._html_search_regex(
- r'<div.*?name="div_video".*?flashvars="([^"]+)">',
- webpage, 'video URL')
+ data = self._download_xml(
+ 'http://www.firstpost.com/getvideoxml-%s.xml' % video_id, video_id,
+ 'Downloading video XML')
+
+ item = data.find('./playlist/item')
+ thumbnail = item.find('./image').text
+ title = item.find('./title').text
+
+ formats = [
+ {
+ 'url': details.find('./file').text,
+ 'format_id': details.find('./label').text.strip(),
+ 'width': int(details.find('./width').text.strip()),
+ 'height': int(details.find('./height').text.strip()),
+ } for details in item.findall('./source/file_details') if details.find('./file').text
+ ]
return {
'id': video_id,
- 'url': video_url,
- 'title': self._og_search_title(webpage),
- 'description': self._og_search_description(webpage),
- 'thumbnail': self._og_search_thumbnail(webpage),
+ 'title': title,
+ 'thumbnail': thumbnail,
+ 'formats': formats,
}
diff --git a/youtube_dl/extractor/prosiebensat1.py b/youtube_dl/extractor/prosiebensat1.py
index 3f585bebf..1e84b175f 100644
--- a/youtube_dl/extractor/prosiebensat1.py
+++ b/youtube_dl/extractor/prosiebensat1.py
@@ -160,6 +160,7 @@ class ProSiebenSat1IE(InfoExtractor):
_CLIPID_REGEXES = [
r'"clip_id"\s*:\s+"(\d+)"',
r'clipid: "(\d+)"',
+ r'clipId=(\d+)',
]
_TITLE_REGEXES = [
r'<h2 class="subtitle" itemprop="name">\s*(.+?)</h2>',
diff --git a/youtube_dl/extractor/weibo.py b/youtube_dl/extractor/weibo.py
index fa784ab99..b24297a40 100644
--- a/youtube_dl/extractor/weibo.py
+++ b/youtube_dl/extractor/weibo.py
@@ -1,10 +1,11 @@
# coding: utf-8
+from __future__ import unicode_literals
import re
-import json
from .common import InfoExtractor
+
class WeiboIE(InfoExtractor):
"""
The videos in Weibo come from different sites, this IE just finds the link
@@ -13,16 +14,16 @@ class WeiboIE(InfoExtractor):
_VALID_URL = r'https?://video\.weibo\.com/v/weishipin/t_(?P<id>.+?)\.htm'
_TEST = {
- u'add_ie': ['Sina'],
- u'url': u'http://video.weibo.com/v/weishipin/t_zjUw2kZ.htm',
- u'file': u'98322879.flv',
- u'info_dict': {
- u'title': u'魔声耳机最新广告“All Eyes On Us”',
+ 'url': 'http://video.weibo.com/v/weishipin/t_zjUw2kZ.htm',
+ 'info_dict': {
+ 'id': '98322879',
+ 'ext': 'flv',
+ 'title': '魔声耳机最新广告“All Eyes On Us”',
},
- u'note': u'Sina video',
- u'params': {
- u'skip_download': True,
+ 'params': {
+ 'skip_download': True,
},
+ 'add_ie': ['Sina'],
}
# Additional example videos from different sites
@@ -33,17 +34,16 @@ class WeiboIE(InfoExtractor):
mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE)
video_id = mobj.group('id')
info_url = 'http://video.weibo.com/?s=v&a=play_list&format=json&mix_video_id=t_%s' % video_id
- info_page = self._download_webpage(info_url, video_id)
- info = json.loads(info_page)
+ info = self._download_json(info_url, video_id)
videos_urls = map(lambda v: v['play_page_url'], info['result']['data'])
- #Prefer sina video since they have thumbnails
- videos_urls = sorted(videos_urls, key=lambda u: u'video.sina.com' in u)
+ # Prefer sina video since they have thumbnails
+ videos_urls = sorted(videos_urls, key=lambda u: 'video.sina.com' in u)
player_url = videos_urls[-1]
- m_sina = re.match(r'https?://video.sina.com.cn/v/b/(\d+)-\d+.html', player_url)
+ m_sina = re.match(r'https?://video\.sina\.com\.cn/v/b/(\d+)-\d+\.html',
+ player_url)
if m_sina is not None:
self.to_screen('Sina video detected')
sina_id = m_sina.group(1)
player_url = 'http://you.video.sina.com.cn/swf/quotePlayer.swf?vid=%s' % sina_id
return self.url_result(player_url)
-