]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/gaskrank.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class GaskrankIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?gaskrank\.tv/tv/(?P<categories>[^/]+)/(?P<id>[^/]+)\.htm'
16 'url': 'http://www.gaskrank.tv/tv/motorrad-fun/strike-einparken-durch-anfaenger-crash-mit-groesserem-flurschaden.htm',
17 'md5': '1ae88dbac97887d85ebd1157a95fc4f9',
21 'title': 'Strike! Einparken können nur Männer - Flurschaden hält sich in Grenzen *lol*',
22 'thumbnail': r
're:^https?://.*\.jpg$',
23 'categories': ['motorrad-fun'],
24 'display_id': 'strike-einparken-durch-anfaenger-crash-mit-groesserem-flurschaden',
25 'uploader_id': 'Bikefun',
26 'upload_date': '20170110',
30 'url': 'http://www.gaskrank.tv/tv/racing/isle-of-man-tt-2011-michael-du-15920.htm',
31 'md5': 'c33ee32c711bc6c8224bfcbe62b23095',
35 'title': 'Isle of Man - Michael Dunlop vs Guy Martin - schwindelig kucken',
36 'thumbnail': r
're:^https?://.*\.jpg$',
37 'categories': ['racing'],
38 'display_id': 'isle-of-man-tt-2011-michael-du-15920',
40 'upload_date': '20170523',
41 'uploader_url': 'www.iomtt.com',
45 def _real_extract(self
, url
):
46 display_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, display_id
)
50 title
= self
._og
_search
_title
(
51 webpage
, default
=None) or self
._html
_search
_meta
(
52 'title', webpage
, fatal
=True)
54 categories
= [re
.match(self
._VALID
_URL
, url
).group('categories')]
57 r
'Video von:\s*(?P<uploader_id>[^|]*?)\s*\|\s*vom:\s*(?P<upload_date>[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9][0-9])',
60 uploader_id
= mobj
.groupdict().get('uploader_id')
61 upload_date
= unified_strdate(mobj
.groupdict().get('upload_date'))
63 uploader_url
= self
._search
_regex
(
64 r
'Homepage:\s*<[^>]*>(?P<uploader_url>[^<]*)',
65 webpage
, 'uploader_url', default
=None)
67 r
'/tv/tags/[^/]+/"\s*>(?P<tag>[^<]*?)<',
70 view_count
= self
._search
_regex
(
71 r
'class\s*=\s*"gkRight"(?:[^>]*>\s*<[^>]*)*icon-eye-open(?:[^>]*>\s*<[^>]*)*>\s*(?P<view_count>[0-9\.]*)',
72 webpage
, 'view_count', default
=None)
74 view_count
= int_or_none(view_count
.replace('.', ''))
76 average_rating
= self
._search
_regex
(
77 r
'itemprop\s*=\s*"ratingValue"[^>]*>\s*(?P<average_rating>[0-9,]+)',
78 webpage
, 'average_rating')
80 average_rating
= float_or_none(average_rating
.replace(',', '.'))
82 video_id
= self
._search
_regex
(
83 r
'https?://movies\.gaskrank\.tv/([^-]*?)(-[^\.]*)?\.mp4',
84 webpage
, 'video id', default
=display_id
)
86 entry
= self
._parse
_html
5_media
_entries
(url
, webpage
, video_id
)[0]
90 'categories': categories
,
91 'display_id': display_id
,
92 'uploader_id': uploader_id
,
93 'upload_date': upload_date
,
94 'uploader_url': uploader_url
,
96 'view_count': view_count
,
97 'average_rating': average_rating
,
99 self
._sort
_formats
(entry
['formats'])