aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/megavideozeu.py
blob: e77b5f7346ce2df2e55bdf18baa50733702ae3dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# encoding: utf-8
from __future__ import unicode_literals

from .common import InfoExtractor
from ..utils import (
    int_or_none,
    parse_filesize,
    unified_strdate,
)


class MegavideozeuIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?megavideoz\.eu/video/(?P<id>.*)(?:.*)'

    def _real_extract(self, url):
        tmp_video_id = self._match_id(url)

        webpage = self._download_webpage(url, tmp_video_id)

        config_php = self._html_search_regex(
            r'var cnf = \'([^\']+)\'', webpage, 'config.php url')

	configpage = self._download_webpage(config_php, tmp_video_id)

        video_id = self._html_search_regex(
            r'<mediaid>([^<]+)', configpage, 'video id')
        video_url = self._html_search_regex(
            r'<file>([^<]+)', configpage, 'video URL')
        title = self._html_search_regex(
            r'<title><!\[CDATA\[([^\]]+)', configpage, 'title')
        duration = int_or_none(self._html_search_regex(
            r'<duration>([0-9]+)', configpage, 'duration', fatal=False))

        return {
            'id': video_id,
            'url': video_url,
            'title': title,
            'duration': duration
        }