[keek] extract uploader and uploader id with _search_regex

This commit is contained in:
remitamine 2015-09-27 19:09:48 +01:00 committed by Sergey M․
parent f30e9976d6
commit 98e1c935a1

View file

@ -1,8 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
@ -26,10 +24,6 @@ def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
uploader = uploader_id = None
matches = re.search(r'data-username="(?P<uploader>[^"]+)"[^>]*data-user-id="(?P<uploader_id>[^"]+)"', webpage)
if matches:
uploader, uploader_id = matches.groups()
return { return {
'id': video_id, 'id': video_id,
@ -38,6 +32,6 @@ def _real_extract(self, url):
'title': self._og_search_title(webpage), 'title': self._og_search_title(webpage),
'description': self._og_search_description(webpage), 'description': self._og_search_description(webpage),
'thumbnail': self._og_search_thumbnail(webpage), 'thumbnail': self._og_search_thumbnail(webpage),
'uploader': uploader, 'uploader': self._search_regex(r'data-username="([^"]+)"', webpage, 'uploader', None),
'uploader_id': uploader_id, 'uploader_id': self._search_regex(r'data-user-id="([^"]+)"', webpage, 'uploader id', None),
} }