1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-02 05:07:55 +01:00
youtube-dl/youtube_dl/extractor/acidcow.py

56 lines
1.6 KiB
Python
Raw Normal View History

2020-03-29 03:47:16 +02: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.
"""
# _VALID_URL = r'https?://app.matter.online/tracks/((?P<id>\d+)-(?P<title>\S+))/?'
2020-03-30 06:54:05 +02:00
# VALID_URL = r'https?://acidcow.com/video/([0-9]+-(?P<title>\S+))/?'
# # r'https://cdn.acidcow.com/pics/%s/video/(\S+)' % video_id, video_id
# r'<video src="https://cdn.acidcow.com/pics/([0-9]+/(?P<title>\S+))"/>',
2020-03-31 05:42:50 +02:00
# _VALID_URL = r'https?://acidcow\.com/video/[0-9]+\S+'
_VALID_URL = r'https?://acidcow\.com/video/(?P<id>\d+)-\S+'
2020-03-29 03:47:16 +02:00
_TESTS = {
# TODO: Implement
}
def _real_extract(self, url):
video_id = self._match_id(url)
2020-03-31 06:30:15 +02:00
'''
2020-03-29 03:47:16 +02:00
webpage = self._download_webpage(
2020-03-31 05:55:00 +02:00
r'https://cdn\.acidcow\.com/pics/[0-9]+/video/\S', video_id
2020-03-29 03:47:16 +02:00
)
2020-03-31 06:30:15 +02:00
'''
webpage = self._download_webpage(
"https://acidcow.com/video/116642-that_was_really_close.html", video_id
)
2020-03-29 03:47:16 +02:00
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
2020-03-31 06:34:02 +02:00
'''
2020-03-29 03:47:16 +02:00
download_url = self._html_search_regex(
2020-03-30 06:54:05 +02:00
2020-03-31 05:55:00 +02:00
r'<video src="https://cdn\.acidcow\.com/pics/[0-9]+/video/\S+" .+',
2020-03-29 03:47:16 +02:00
webpage, "download_url"
)
2020-03-31 06:34:02 +02:00
'''
download_url = self._html_search_regex(
2020-03-29 03:47:16 +02:00
2020-03-31 06:41:23 +02:00
r'https://cdn\.acidcow\.com/pics/[0-9]+/video/\S+',
2020-03-31 06:34:02 +02:00
webpage, "download_url"
)
2020-03-29 03:47:16 +02:00
return {
'id': video_id,
'url': download_url,
'title': title
}