mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-15 18:34:22 +00:00
[vube] Improve URL detection and extract timestamp
This commit is contained in:
parent
f71959fcf5
commit
b5368acee8
@ -1,7 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import datetime
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
@ -9,23 +8,42 @@ from .common import InfoExtractor
|
|||||||
class VubeIE(InfoExtractor):
|
class VubeIE(InfoExtractor):
|
||||||
IE_NAME = 'vube'
|
IE_NAME = 'vube'
|
||||||
IE_DESC = 'Vube.com'
|
IE_DESC = 'Vube.com'
|
||||||
_VALID_URL = r'http://vube\.com/[^/]+/(?P<id>[\da-zA-Z]{10})'
|
_VALID_URL = r'http://vube\.com/(?:[^/]+/)+(?P<id>[\da-zA-Z]{10})\b'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
'url': 'http://vube.com/Chiara+Grispo+Video+Channel/YL2qNPkqon',
|
{
|
||||||
'md5': 'db7aba89d4603dadd627e9d1973946fe',
|
'url': 'http://vube.com/Chiara+Grispo+Video+Channel/YL2qNPkqon',
|
||||||
'info_dict': {
|
'md5': 'db7aba89d4603dadd627e9d1973946fe',
|
||||||
'id': 'YL2qNPkqon',
|
'info_dict': {
|
||||||
'ext': 'mp4',
|
'id': 'YL2qNPkqon',
|
||||||
'title': 'Chiara Grispo - Price Tag by Jessie J',
|
'ext': 'mp4',
|
||||||
'description': 'md5:8ea652a1f36818352428cb5134933313',
|
'title': 'Chiara Grispo - Price Tag by Jessie J',
|
||||||
'thumbnail': 'http://frame.thestaticvube.com/snap/228x128/102e7e63057-5ebc-4f5c-4065-6ce4ebde131f.jpg',
|
'description': 'md5:8ea652a1f36818352428cb5134933313',
|
||||||
'uploader': 'Chiara.Grispo',
|
'thumbnail': 'http://frame.thestaticvube.com/snap/228x128/102e7e63057-5ebc-4f5c-4065-6ce4ebde131f.jpg',
|
||||||
'uploader_id': '1u3hX0znhP',
|
'uploader': 'Chiara.Grispo',
|
||||||
'upload_date': '20140103',
|
'uploader_id': '1u3hX0znhP',
|
||||||
'duration': 170.56
|
'timestamp': 1388743358,
|
||||||
|
'upload_date': '20140103',
|
||||||
|
'duration': 170.56
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://vube.com/SerainaMusic/my-7-year-old-sister-and-i-singing-alive-by-krewella/UeBhTudbfS?t=s&n=1',
|
||||||
|
'md5': '5d4a52492d76f72712117ce6b0d98d08',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'UeBhTudbfS',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'My 7 year old Sister and I singing "Alive" by Krewella',
|
||||||
|
'description': 'md5:40bcacb97796339f1690642c21d56f4a',
|
||||||
|
'thumbnail': 'http://frame.thestaticvube.com/snap/228x128/102265d5a9f-0f17-4f6b-5753-adf08484ee1e.jpg',
|
||||||
|
'uploader': 'Seraina',
|
||||||
|
'uploader_id': 'XU9VE2BQ2q',
|
||||||
|
'timestamp': 1396492438,
|
||||||
|
'upload_date': '20140403',
|
||||||
|
'duration': 240.107
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@ -52,7 +70,7 @@ class VubeIE(InfoExtractor):
|
|||||||
thumbnail = 'http:' + thumbnail
|
thumbnail = 'http:' + thumbnail
|
||||||
uploader = video['user_alias']
|
uploader = video['user_alias']
|
||||||
uploader_id = video['user_url_id']
|
uploader_id = video['user_url_id']
|
||||||
upload_date = datetime.datetime.fromtimestamp(int(video['upload_time'])).strftime('%Y%m%d')
|
timestamp = int(video['upload_time'])
|
||||||
duration = video['duration']
|
duration = video['duration']
|
||||||
view_count = video['raw_view_count']
|
view_count = video['raw_view_count']
|
||||||
like_count = video['total_likes']
|
like_count = video['total_likes']
|
||||||
@ -71,7 +89,7 @@ class VubeIE(InfoExtractor):
|
|||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
'upload_date': upload_date,
|
'timestamp': timestamp,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'like_count': like_count,
|
'like_count': like_count,
|
||||||
|
Loading…
Reference in New Issue
Block a user