6 from .common import InfoExtractor
12 class GooglePlusIE(InfoExtractor):
13 IE_DESC = u'Google Plus'
14 _VALID_URL = r'(?:https://)?plus\.google\.com/(?:[^/]+/)*?posts/(\w+)'
15 IE_NAME = u'plus.google'
17 u"url": u"https://plus.google.com/u/0/108897254135232129896/posts/ZButuJc6CtH",
18 u"file": u"ZButuJc6CtH.flv",
20 u"upload_date": u"20120613",
21 u"uploader": u"井上ヨシマサ",
26 def _real_extract(self, url):
28 mobj = re.match(self._VALID_URL, url)
30 raise ExtractorError(u'Invalid URL: %s' % url)
32 post_url = mobj.group(0)
33 video_id = mobj.group(1)
35 video_extension = 'flv'
37 # Step 1, Retrieve post webpage to extract further information
38 webpage = self._download_webpage(post_url, video_id, u'Downloading entry webpage')
40 self.report_extraction(video_id)
43 upload_date = self._html_search_regex(
44 r'''(?x)<a.+?class="o-U-s\s[^"]+"\s+style="display:\s*none"\s*>
45 ([0-9]{4}-[0-9]{2}-[0-9]{2})</a>''',
46 webpage, u'upload date', fatal=False, flags=re.VERBOSE)
48 # Convert timestring to a format suitable for filename
49 upload_date = datetime.datetime.strptime(upload_date, "%Y-%m-%d")
50 upload_date = upload_date.strftime('%Y%m%d')
53 uploader = self._html_search_regex(r'rel\="author".*?>(.*?)</a>',
54 webpage, u'uploader', fatal=False)
57 # Get the first line for title
58 video_title = self._html_search_regex(r'<meta name\=\"Description\" content\=\"(.*?)[\n<"]',
59 webpage, 'title', default=u'NA')
61 # Step 2, Simulate clicking the image box to launch video
62 DOMAIN = 'https://plus.google.com/'
63 video_page = self._search_regex(r'<a href="((?:%s)?photos/.*?)"' % re.escape(DOMAIN),
64 webpage, u'video page URL')
65 if not video_page.startswith(DOMAIN):
66 video_page = DOMAIN + video_page
68 webpage = self._download_webpage(video_page, video_id, u'Downloading video page')
70 # Extract video links on video page
71 """Extract video links of all sizes"""
72 pattern = r'\d+,\d+,(\d+),"(http\://redirector\.googlevideo\.com.*?)"'
73 mobj = re.findall(pattern, webpage)
75 raise ExtractorError(u'Unable to extract video links')
80 # Choose the lowest of the sort, i.e. highest resolution
82 # Only get the url. The resolution part in the tuple has no use anymore
83 video_url = video_url[-1]
84 # Treat escaped \u0026 style hex
86 video_url = video_url.decode("unicode_escape")
87 except AttributeError: # Python 3
88 video_url = bytes(video_url, 'ascii').decode('unicode-escape')
95 'upload_date': upload_date,
97 'ext': video_extension,