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

[esix] Add new extractor #26761

Closed
wants to merge 1 commit 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
38 changes: 38 additions & 0 deletions youtube_dl/extractor/esix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# coding: utf-8
from __future__ import unicode_literals

from .common import InfoExtractor
from ..utils import ExtractorError


class esixIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:e621|e926).net/posts/(?P<id>[0-9]+)'
_TEST = {
'url': 'https://e621.net/posts/2429748',
'md5': 'f2b2773d3de744141ed999af74b73391',
'info_dict': {
'id': '2429748',
'ext': 'webm',
'title': '0bfc03a8b40f6e4bff3df2c376b14f37',
'thumbnail': 'https://static1.e621.net/data/sample/0b/fc/0bfc03a8b40f6e4bff3df2c376b14f37.jpg',
'description': 'From source:\r\n[quote]\r\nPorter Robinson - Something Comforting \r\nhttps://youtu.be/-C-2AqRD8io\r\n\r\nCollaboration with Porter Robinson.\r\nポーター・ロビンソンとのオフィシャルコラボです。\r\n\r\n------------------------------------\r\n\r\n■ブルーハムハムとは?\r\n音を食べて生きている\"宇宙ハムスター\"。不運なことに地球旅行の途中で迷子になり、地球人に拾われる。人間社会のさまざまな音を食べて、その美味しさに驚愕。地球上のいろんな音楽を味わうことが夢になった。\r\n\r\nTwitter:https://twitter.com/THEBLUEHAMHAM\r\nInstagram:https://www.instagram.com/thebluehamham/\r\n[/quote]'
}
}

def _real_extract(self, url):
video_id = self._match_id(url)
post = self._download_json(url + '.json', video_id).get('post')
fmts = ['webm', 'mp4']
ext = post.get('file').get('ext')

if ext not in fmts:
raise ExtractorError('Specified post is not a video', expected=True)

return {
'id': video_id,
'title': post.get('file').get('md5'),
'url': post.get('file').get('url'),
'ext': ext,
'thumbnail': post.get('sample').get('url'),
'description': post.get('description')
}
1 change: 1 addition & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
from .eporner import EpornerIE
from .eroprofile import EroProfileIE
from .escapist import EscapistIE
from .esix import esixIE
from .espn import (
ESPNIE,
ESPNArticleIE,
Expand Down