1
0
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:
root 2020-07-03 18:25:44 -07:00
parent 07af16b92e
commit 3175e76ad0
2 changed files with 42 additions and 0 deletions

View File

@ -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

View 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,
}