Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Full30] Add new extractor #12988

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
- **Freesound**
- **freespeech.org**
- **FreshLive**
- **Full30**
- **Funimation**
- **FunnyOrDie**
- **Fusion**
Expand Down
1 change: 1 addition & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
from .freesound import FreesoundIE
from .freespeech import FreespeechIE
from .freshlive import FreshLiveIE
from .full30 import Full30IE
from .funimation import FunimationIE
from .funnyordie import FunnyOrDieIE
from .fusion import FusionIE
Expand Down
59 changes: 59 additions & 0 deletions youtube_dl/extractor/full30.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# coding: utf-8
from __future__ import unicode_literals

from .common import InfoExtractor
from ..utils import int_or_none


class Full30IE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?full30\.com/video/(?P<id>[a-f0-9]+)'
_TEST = {
'url': 'http://www.full30.com/video/b2a28b99494164ddd55e91a6c4648cbc',
'md5': 'f5aa3862cbe35c2083ce050ac1a5eb06',
'info_dict': {
'id': 'b2a28b99494164ddd55e91a6c4648cbc',
'title': 'Flamethrower Q&A with Charlie Hobson',
'uploader': 'Forgotten Weapons',
'thumbnail': r're:^https?://.*52130\.jpg$',
'ext': 'ogv',
}
}

def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)

title = self._html_search_regex(r'<h1 [^>]*class=.video-title[^>]*>([^<]+?)</h1>', webpage, 'title', fatal=False, default=None) or self._og_search_title(webpage) or video_id
uploader = self._html_search_regex(r'<h1 class=.channel-title[^>]*>([^<]+)<', webpage, 'uploader', fatal=False, default=None) or None
thumbnail = self._html_search_regex(r'<[^>]*property=.og:image. ?content="([^>]*thumbnails[^">]*)"\/>', webpage, 'thumbnail', fatal=False, default=None) or self._og_search_thumbnail(webpage)

# looking for a line like the following
# <input id="video-path" type="hidden" name="video_path" value="https://videos.full30.com/bitmotive/public/full30/v1.0/videos/forgottenweapons/b2a28b99494164ddd55e91a6c4648cbc/" />
# there's also a full30.com/cdn which appears to have the same sort of structure. it's possible that either of these may go away so as a backup I'll build the cdn link out from channel slug
vid_path = self._html_search_regex(r'<input id=.video-path[^>]*value=["\']([^"\']*)["\'][^>]*>', webpage, 'video_path', fatal=False, default=None)
if not vid_path:
channel_slug = self._html_search_regex(r'<input id=.channel-slug[^>]*value=["\']([^"\']*)["\'][^>]*>', webpage, 'channel_slug', fatal=True)
vid_path = 'https://www.full30.com/cdn/videos/' + channel_slug + '/' + video_id + '/'

vid_json = self._download_webpage(vid_path, video_id)
# turn sequence of json entries into an actual list
vid_json = vid_json.rstrip()
vid_json = '[' + vid_json + ']'
vid_json = vid_json.replace('}', '},').replace(',]', ']')
parsed = self._parse_json(vid_json, video_id)

formats = [{
'url': vid_path + entry['name'],
'resolution': entry['name'][:entry['name'].rfind('.')],
'filesize': int_or_none(entry['size']),
} for entry in parsed if entry.get('type') == 'object']

self._sort_formats(formats)

return {
'id': video_id,
'title': title,
'uploader': uploader,
'thumbnail': thumbnail,
'formats': formats,
}