]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ninegag.py
4 from . common
import InfoExtractor
7 class NineGagIE ( InfoExtractor
):
9 _VALID_URL
= r
'^https?://(?:www\.)?9gag\.tv/v/(?P<id>[0-9]+)'
12 u
"url" : u
"http://9gag.tv/v/1912" ,
15 u
"description" : u
"This 3-minute video will make you smile and then make you feel untalented and insignificant. Anyway, you should share this awesomeness. (Thanks, Dino!)" ,
16 u
"title" : u
" \" People Are Awesome 2013 \" Is Absolutely Awesome"
18 u
'add_ie' : [ u
'Youtube' ]
21 def _real_extract ( self
, url
):
22 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
23 video_id
= mobj
. group ( 'id' )
25 webpage
= self
._ download
_ webpage
( url
, video_id
)
26 data_json
= self
._ html
_ search
_ regex
( r
'''(?x)
27 <div\s*id="tv-video"\s*data-video-source="youtube"\s*
28 data-video-meta="([^"]+)"''' , webpage
, u
'video metadata' )
30 data
= json
. loads ( data_json
)
33 '_type' : 'url_transparent' ,
34 'url' : data
[ 'youtubeVideoId' ],
37 'title' : data
[ 'title' ],
38 'description' : data
[ 'description' ],
39 'view_count' : int ( data
[ 'view_count' ]),
40 'like_count' : int ( data
[ 'statistic' ][ 'like' ]),
41 'dislike_count' : int ( data
[ 'statistic' ][ 'dislike' ]),
42 'thumbnail' : data
[ 'thumbnail_url' ],