mirror of
https://github.com/l1ving/youtube-dl
synced 2020-11-18 19:53:54 -08:00
[Gab] Add new extractor
This commit is contained in:
parent
07af16b92e
commit
3175e76ad0
@ -396,6 +396,7 @@ from .funk import FunkIE
|
||||
from .fusion import FusionIE
|
||||
from .fxnetworks import FXNetworksIE
|
||||
from .gaia import GaiaIE
|
||||
from .gab import GabIE
|
||||
from .gameinformer import GameInformerIE
|
||||
from .gamespot import GameSpotIE
|
||||
from .gamestar import GameStarIE
|
||||
|
41
youtube_dl/extractor/gab.py
Normal file
41
youtube_dl/extractor/gab.py
Normal file
@ -0,0 +1,41 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
|
||||
# Run the following to test
|
||||
# python test/test_download.py TestDownload.test_Gab
|
||||
|
||||
|
||||
class GabIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?gab\.com/\w+/posts/(?P<id>[0-9]+)+'
|
||||
_TESTS = [
|
||||
{
|
||||
'url': 'https://gab.com/ACT1TV/posts/104450493441154721',
|
||||
'md5': '04bbd2146e0afe033eb1cb184f3748ce',
|
||||
'info_dict': {
|
||||
'id': '104450493441154721',
|
||||
'ext': 'mp4',
|
||||
'title': 'Bill Blaze on Gab: \'He shoots, he scores and the crowd went wild.... \u2026\' - Gab Social',
|
||||
'description': 'Bill Blaze on Gab: \'He shoots, he scores and the crowd went wild.... \u2026\'',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
mobj = re.match(self._VALID_URL, url)
|
||||
video_id = mobj.group('id')
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
|
||||
|
||||
url_result = re.search('https?://(?:www\.)?gab\.com/system/media_attachments/files/[0-9]+/[0-9]+/[0-9]+/original/\w+\.\w+', webpage)
|
||||
video_url = url_result.group()
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'title': title,
|
||||
'description': self._og_search_description(webpage),
|
||||
'url': video_url,
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user