aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ <T@Js-iMac.local>2017-01-06 21:56:59 +0100
committerSergey M․ <dstftw@gmail.com>2017-01-08 20:17:18 +0700
commit553c68bbd98621580339f0d4b4b7129ce8455553 (patch)
tree2be9b4993c645412e066df98c5e5e61d689a482d
parent827961b12216a6d7130b5ced80e4a3d50a1e60ca (diff)
downloadyoutube-dl-553c68bbd98621580339f0d4b4b7129ce8455553.tar.xz
[hitrecord] Add extractor
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/hitrecord.py48
2 files changed, 49 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index ed9a133ea..f7f6c025f 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -366,6 +366,7 @@ from .hgtv import (
)
from .historicfilms import HistoricFilmsIE
from .hitbox import HitboxIE, HitboxLiveIE
+from .hitrecord import HitRecordIE
from .hornbunny import HornBunnyIE
from .hotnewhiphop import HotNewHipHopIE
from .hotstar import HotStarIE
diff --git a/youtube_dl/extractor/hitrecord.py b/youtube_dl/extractor/hitrecord.py
new file mode 100644
index 000000000..35bbb3eb8
--- /dev/null
+++ b/youtube_dl/extractor/hitrecord.py
@@ -0,0 +1,48 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ clean_html,
+ int_or_none,
+ unified_strdate,
+)
+from ..compat import compat_str
+
+
+class HitRecordIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?hitrecord\.org/records/(?P<id>\d+)'
+
+ _TEST = {
+ 'url': 'https://hitrecord.org/records/2954362',
+ 'md5': 'fe1cdc2023bce0bbb95c39c57426aa71',
+ 'info_dict': {
+ 'id': '2954362',
+ 'ext': 'mp4',
+ 'title': 'A Very Different World (HITRECORD x ACLU)',
+ 'description': 'md5:e62defaffab5075a5277736bead95a3d',
+ 'release_date': '20160818',
+ 'timestamp': 1471557582,
+ 'uploader': 'Zuzi.C12',
+ 'uploader_id': '362811',
+ }
+ }
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ video_info = self._download_json('https://hitrecord.org/api/web/records/' + video_id, video_id)
+ user_info = video_info.get('user', {})
+
+ return {
+ 'id': video_id,
+ 'title': video_info['title'],
+ 'url': video_info['source_url']['mp4_url'],
+ 'description': clean_html(video_info.get('body')),
+ 'uploader': user_info.get('username'),
+ 'uploader_id': compat_str(user_info.get('id')),
+ 'release_date': unified_strdate(video_info.get('created_at')),
+ 'timestamp': video_info.get('created_at_i'),
+ 'view_count': int_or_none(video_info.get('total_views_count')),
+ 'like_count': int_or_none(video_info.get('hearts_count')),
+ 'comment_count': int_or_none(video_info.get('comments_count')),
+ 'tags': [tag.get('text') for tag in video_info.get('tags', [])],
+ }