]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/roosterteeth.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class RoosterTeethIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:.+?\.)?roosterteeth\.com/episode/(?P<id>[^/?#&]+)'
13 _LOGIN_URL
= 'https://roosterteeth.com/login'
14 _NETRC_MACHINE
= 'roosterteeth'
16 'url': 'http://roosterteeth.com/episode/million-dollars-but-season-2-million-dollars-but-the-game-announcement',
20 'title': 'Million Dollars, But... The Game Announcement',
21 'thumbnail': 're:^https?://.*\.png$',
22 'description': 'Introducing Million Dollars, But... The Game! Available for pre-order now at www.MDBGame.com ',
23 'creator': 'Rooster Teeth',
24 'series': 'Million Dollars, But...',
25 'episode': 'Million Dollars, But... The Game Announcement',
26 'episode_id': '26576',
29 'skip_download': True, # m3u8 downloads
32 'url': 'http://achievementhunter.roosterteeth.com/episode/off-topic-the-achievement-hunter-podcast-2016-i-didn-t-think-it-would-pass-31',
33 'only_matching': True,
35 'url': 'http://funhaus.roosterteeth.com/episode/funhaus-shorts-2016-austin-sucks-funhaus-shorts',
36 'only_matching': True,
38 'url': 'http://screwattack.roosterteeth.com/episode/death-battle-season-3-mewtwo-vs-shadow',
39 'only_matching': True,
41 'url': 'http://theknow.roosterteeth.com/episode/the-know-game-news-season-1-boring-steam-sales-are-better',
42 'only_matching': True,
46 (username
, password
) = self
._get
_login
_info
()
47 if username
is None or password
is None:
50 # token is required to authenticate request
51 login_page
= self
._download
_webpage
(self
._LOGIN
_URL
, None, 'Getting login token', 'Unable to get login token')
53 login_form
= self
._hidden
_inputs
(login_page
)
58 login_payload
= urlencode_postdata(login_form
)
60 # required for proper responses
62 'Referer': self
._LOGIN
_URL
,
65 login_request
= self
._download
_webpage
(
66 self
._LOGIN
_URL
, None,
67 note
='Logging in as %s' % username
,
69 headers
=login_headers
)
71 if 'Authentication failed' in login_request
:
73 'Login failed (invalid username/password)', expected
=True)
75 def _real_initialize(self
):
78 def _real_extract(self
, url
):
79 match_id
= self
._match
_id
(url
)
80 webpage
= self
._download
_webpage
(url
, match_id
)
82 episode_id
= self
._html
_search
_regex
(r
"commentControls\('#comment-([0-9]+)'\)", webpage
, 'episode id', match_id
, False)
84 self
.report_extraction(episode_id
)
86 title
= self
._html
_search
_regex
(r
'<title>([^<]+)</title>', webpage
, 'episode title', self
._og
_search
_title
(webpage
), False)
87 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
88 description
= self
._og
_search
_description
(webpage
)
89 creator
= self
._html
_search
_regex
(r
'<h3>Latest (.+) Gear</h3>', webpage
, 'site', 'Rooster Teeth', False)
90 series
= self
._html
_search
_regex
(r
'<h2>More ([^<]+)</h2>', webpage
, 'series', fatal
=False)
91 episode
= self
._html
_search
_regex
(r
'<title>([^<]+)</title>', webpage
, 'episode title', fatal
=False)
93 if '<div class="non-sponsor">' in webpage
:
94 self
.raise_login_required('%s is only available for FIRST members' % title
)
96 if '<div class="golive-gate">' in webpage
:
97 self
.raise_login_required('%s is not available yet' % title
)
99 formats
= self
._extract
_m
3u8_formats
(self
._html
_search
_regex
(r
"file: '(.+?)m3u8'", webpage
, 'm3u8 url') + 'm3u8', episode_id
, ext
='mp4')
100 self
._sort
_formats
(formats
)
106 'thumbnail': thumbnail
,
107 'description': description
,
111 'episode_id': episode_id
,