4 from .common
import InfoExtractor
15 class VeohIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?veoh\.com/(?:watch|videos|embed|iphone/#_Watch)/(?P<id>(?:v|e|yapi-)[\da-zA-Z]+)'
19 'url': 'http://www.veoh.com/watch/v56314296nk7Zdmz3',
20 'md5': '620e68e6a3cff80086df3348426c9ca3',
22 'id': 'v56314296nk7Zdmz3',
24 'title': 'Straight Backs Are Stronger',
25 'description': 'md5:203f976279939a6dc664d4001e13f5f4',
26 'thumbnail': 're:https://fcache\\.veoh\\.com/file/f/th56314296\\.jpg(\\?.*)?',
27 'uploader': 'LUMOback',
30 'average_rating': int,
33 'categories': ['technology_and_gaming'],
34 'tags': ['posture', 'posture', 'sensor', 'back', 'pain', 'wearable', 'tech', 'lumo'],
37 'url': 'http://www.veoh.com/embed/v56314296nk7Zdmz3',
38 'only_matching': True,
40 'url': 'http://www.veoh.com/watch/v27701988pbTc4wzN?h1=Chile+workers+cover+up+to+avoid+skin+damage',
41 'md5': '4a6ff84b87d536a6a71e6aa6c0ad07fa',
45 'title': 'Chile workers cover up to avoid skin damage',
46 'description': 'md5:2bd151625a60a32822873efc246ba20d',
47 'uploader': 'afp-news',
50 'skip': 'This video has been deleted.',
52 'url': 'http://www.veoh.com/watch/v69525809F6Nc4frX',
53 'md5': '4fde7b9e33577bab2f2f8f260e30e979',
54 'note': 'Embedded ooyala video',
58 'title': 'Doctors Alter Plan For Preteen\'s Weight Loss Surgery',
59 'description': 'md5:f5a11c51f8fb51d2315bca0937526891',
60 'uploader': 'newsy-videos',
62 'skip': 'This video has been deleted.',
64 'url': 'http://www.veoh.com/watch/e152215AJxZktGS',
65 'only_matching': True,
67 'url': 'https://www.veoh.com/videos/v16374379WA437rMH',
68 'md5': 'cceb73f3909063d64f4b93d4defca1b3',
70 'id': 'v16374379WA437rMH',
72 'title': 'Phantasmagoria 2, pt. 1-3',
73 'description': 'Phantasmagoria: a Puzzle of Flesh',
74 'thumbnail': 're:https://fcache\\.veoh\\.com/file/f/th16374379\\.jpg(\\?.*)?',
75 'uploader': 'davidspackage',
78 'average_rating': int,
81 'categories': ['technology_and_gaming', 'gaming'],
82 'tags': ['puzzle', 'of', 'flesh'],
86 def _real_extract(self
, url
):
87 video_id
= self
._match
_id
(url
)
88 metadata
= self
._download
_json
(
89 'https://www.veoh.com/watch/getVideo/' + video_id
,
91 video
= metadata
['video']
92 title
= video
['title']
95 q
= qualities(['Regular', 'HQ'])
97 for f_id
, f_url
in video
.get('src', {}).items():
101 thumbnail_url
= f_url
109 categories
= metadata
.get('categoryPath')
111 category
= try_get(video
, lambda x
: x
['category'].strip().removeprefix('category_'))
112 categories
= [category
] if category
else None
113 tags
= video
.get('tags')
118 'description': video
.get('description'),
119 'thumbnail': thumbnail_url
,
120 'uploader': video
.get('author', {}).get('nickname'),
121 'duration': int_or_none(video
.get('lengthBySec')) or parse_duration(video
.get('length')),
122 'view_count': int_or_none(video
.get('views')),
124 'average_rating': int_or_none(video
.get('rating')),
125 'comment_count': int_or_none(video
.get('numOfComments')),
126 'age_limit': 18 if video
.get('contentRatingId') == 2 else 0,
127 'categories': categories
,
128 'tags': tags
.split(', ') if tags
else None,
132 class VeohUserIE(VeohIE
): # XXX: Do not subclass from concrete IE
133 _VALID_URL
= r
'https?://(?:www\.)?veoh\.com/users/(?P<id>[\w-]+)'
134 IE_NAME
= 'veoh:user'
138 'url': 'https://www.veoh.com/users/valentinazoe',
140 'id': 'valentinazoe',
141 'title': 'valentinazoe (Uploads)',
143 'playlist_mincount': 75,
146 'url': 'https://www.veoh.com/users/PiensaLibre',
149 'title': 'PiensaLibre (Uploads)',
151 'playlist_mincount': 2,
156 def _fetch_page(self
, uploader
, page
):
157 response
= self
._download
_json
(
158 'https://www.veoh.com/users/published/videos', uploader
,
159 note
=f
'Downloading videos page {page + 1}',
161 'x-csrf-token': self
._TOKEN
,
162 'content-type': 'application/json;charset=UTF-8',
165 'username': uploader
,
166 'maxResults': self
._PAGE
_SIZE
,
168 'requestName': 'userPage',
170 if not response
.get('success'):
171 raise ExtractorError(response
['message'])
173 for video
in response
['videos']:
174 yield self
.url_result(f
'https://www.veoh.com/watch/{video["permalinkId"]}', VeohIE
,
175 video
['permalinkId'], video
.get('title'))
177 def _real_initialize(self
):
178 webpage
= self
._download
_webpage
(
179 'https://www.veoh.com', None, note
='Downloading authorization token')
180 self
._TOKEN
= self
._search
_regex
(
181 r
'csrfToken:\s*(["\'])(?P
<token
>[0-9a
-zA
-Z
]{40}
)\
1', webpage,
182 'request token
', group='token
')
184 def _real_extract(self, url):
185 uploader = self._match_id(url)
186 return self.playlist_result(OnDemandPagedList(
187 functools.partial(self._fetch_page, uploader),
188 self._PAGE_SIZE), uploader, f'{uploader}
(Uploads
)')