1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..utils import ExtractorError
9 class TinyPicIE(InfoExtractor):
11 IE_DESC = 'tinypic.com videos'
12 _VALID_URL = r'http://tinypic\.com/player\.php\?v=(?P<id>[^&]+)&s=\d+'
15 'url': 'http://tinypic.com/player.php?v=6xw7tc%3E&s=5#.UtqZmbRFCM8',
16 'md5': '609b74432465364e72727ebc6203f044',
20 'title': 'shadow phenomenon weird',
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
28 webpage = self._download_webpage(url, video_id, 'Downloading page')
30 mobj = re.search(r'(?m)fo\.addVariable\("file",\s"(?P<fileid>[\da-z]+)"\);\n'
31 '\s+fo\.addVariable\("s",\s"(?P<serverid>\d+)"\);', webpage)
33 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
35 file_id = mobj.group('fileid')
36 server_id = mobj.group('serverid')
38 KEYWORDS_SUFFIX = ', Video, images, photos, videos, myspace, ebay, video hosting, photo hosting'
39 keywords = self._html_search_meta('keywords', webpage, 'title')
40 title = keywords[:-len(KEYWORDS_SUFFIX)] if keywords.endswith(KEYWORDS_SUFFIX) else ''
42 video_url = 'http://v%s.tinypic.com/%s.flv' % (server_id, file_id)
43 thumbnail = 'http://v%s.tinypic.com/%s_th.jpg' % (server_id, file_id)
48 'thumbnail': thumbnail,