3 from .common
import InfoExtractor
4 from ..utils
import ExtractorError
7 class TinyPicIE(InfoExtractor
):
9 IE_DESC
= 'tinypic.com videos'
10 _VALID_URL
= r
'https?://(?:.+?\.)?tinypic\.com/player\.php\?v=(?P<id>[^&]+)&s=\d+'
14 'url': 'http://tinypic.com/player.php?v=6xw7tc%3E&s=5#.UtqZmbRFCM8',
15 'md5': '609b74432465364e72727ebc6203f044',
19 'title': 'shadow phenomenon weird',
23 'url': 'http://de.tinypic.com/player.php?v=dy90yh&s=8',
24 'only_matching': True,
28 def _real_extract(self
, url
):
29 mobj
= self
._match
_valid
_url
(url
)
30 video_id
= mobj
.group('id')
32 webpage
= self
._download
_webpage
(url
, video_id
, 'Downloading page')
34 mobj
= re
.search(r
'(?m)fo\.addVariable\("file",\s"(?P<fileid>[\da-z]+)"\);\n'
35 r
'\s+fo\.addVariable\("s",\s"(?P<serverid>\d+)"\);', webpage
)
37 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
39 file_id
= mobj
.group('fileid')
40 server_id
= mobj
.group('serverid')
42 KEYWORDS_SUFFIX
= ', Video, images, photos, videos, myspace, ebay, video hosting, photo hosting'
43 keywords
= self
._html
_search
_meta
('keywords', webpage
, 'title')
44 title
= keywords
[:-len(KEYWORDS_SUFFIX
)] if keywords
.endswith(KEYWORDS_SUFFIX
) else ''
46 video_url
= 'http://v%s.tinypic.com/%s.flv' % (server_id
, file_id
)
47 thumbnail
= 'http://v%s.tinypic.com/%s_th.jpg' % (server_id
, file_id
)
52 'thumbnail': thumbnail
,