1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 06:37:17 +08:00

60 lines
1.6 KiB
Python
Raw Normal View History

2020-03-28 18:47:16 -07:00
from __future__ import unicode_literals
from .common import InfoExtractor
class acidcowIE(InfoExtractor):
"""
InfoExtractor for acid.cow
This class should be used to handle videos. Another class (TODO) will be
used to implement playlists or other content.
"""
2020-03-29 21:54:05 -07:00
2020-03-30 20:42:50 -07:00
_VALID_URL = r'https?://acidcow\.com/video/(?P<id>\d+)-\S+'
2020-04-11 22:21:09 -07:00
_TESTS = [{
'url': 'https://acidcow.com/video/118851-learning_to_follow_patterns_with_dad.html',
'info_dict': {
'id': '118851',
'ext': 'mp4',
'title': 'learning_to_follow_patterns_with_dad',
},
}, {
'url': 'https://acidcow.com/video/116642-that_was_really_close.html',
'info_dict': {
'id': '116642',
'ext': 'mp4',
'title': 'that_was_really_close',
},
}, {
'url': 'https://acidcow.com/video/118850-it_reminds_me_of_cars_scene.html',
'info_dict': {
'id': '118850',
'ext': 'mp4',
'title': 'it_reminds_me_of_cars_scene',
}
2020-03-28 18:47:16 -07:00
2020-04-11 22:21:09 -07:00
}]
2020-03-28 18:47:16 -07:00
def _real_extract(self, url):
video_id = self._match_id(url)
2020-04-01 18:15:51 -07:00
2020-03-30 21:30:15 -07:00
webpage = self._download_webpage(
2020-03-31 22:09:36 -07:00
url, video_id
2020-03-30 21:30:15 -07:00
)
2020-03-28 18:47:16 -07:00
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
2020-03-29 21:54:05 -07:00
2020-03-30 21:34:02 -07:00
download_url = self._html_search_regex(
2020-03-28 18:47:16 -07:00
2020-03-31 19:37:54 -07:00
r'(https://cdn\.acidcow\.com/pics/[0-9]+/video/\S+\.mp4)',
2020-03-30 21:34:02 -07:00
webpage, "download_url"
)
2020-03-28 18:47:16 -07:00
return {
'id': video_id,
'url': download_url,
'title': title
}