3 from .common
import InfoExtractor
6 get_element_by_attribute
,
10 class TMZIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?tmz\.com/.*'
14 'url': 'http://www.tmz.com/videos/0-cegprt2p/',
16 'id': 'http://www.tmz.com/videos/0-cegprt2p/',
18 'title': 'No Charges Against Hillary Clinton? Harvey Says It Ain\'t Over Yet',
19 'description': 'Harvey talks about Director Comey’s decision not to prosecute Hillary Clinton.',
20 'timestamp': 1467831837,
21 'uploader': 'TMZ Staff',
22 'upload_date': '20160706',
23 'thumbnail': 'https://imagez.tmz.com/image/5e/4by3/2016/07/06/5eea7dc01baa5c2e83eb06930c170e46_xl.jpg',
28 'url': 'https://www.tmz.com/videos/071119-chris-morgan-women-4590005-0-zcsejvcr/',
30 'id': 'https://www.tmz.com/videos/071119-chris-morgan-women-4590005-0-zcsejvcr/',
32 'title': 'Angry Bagel Shop Guy Says He Doesn\'t Trust Women',
33 'description': 'The enraged man who went viral for ranting about women on dating sites before getting ragdolled in a bagel shop is defending his misogyny ... he says it\'s women\'s fault in the first place.',
34 'timestamp': 1562889485,
35 'uploader': 'TMZ Staff',
36 'upload_date': '20190711',
37 'thumbnail': 'https://imagez.tmz.com/image/a8/4by3/2019/07/12/a85480d27b2f50a7bfea2322151d67a5_xl.jpg',
42 'url': 'http://www.tmz.com/2015/04/19/bobby-brown-bobbi-kristina-awake-video-concert',
43 'md5': '5429c85db8bde39a473a56ca8c4c5602',
45 'id': 'http://www.tmz.com/2015/04/19/bobby-brown-bobbi-kristina-awake-video-concert',
47 'title': 'Bobby Brown Tells Crowd ... Bobbi Kristina is Awake',
48 'description': 'Bobby Brown stunned his audience during a concert Saturday night, when he told the crowd, "Bobbi is awake. She\'s watching me."',
49 'timestamp': 1429467813,
50 'uploader': 'TMZ Staff',
51 'upload_date': '20150419',
53 'thumbnail': 'https://imagez.tmz.com/image/15/4by3/2015/04/20/1539c7ae136359fc979236fa6a9449dd_xl.jpg',
57 'url': 'http://www.tmz.com/2015/09/19/patti-labelle-concert-fan-stripping-kicked-out-nicki-minaj/',
59 'id': 'http://www.tmz.com/2015/09/19/patti-labelle-concert-fan-stripping-kicked-out-nicki-minaj/',
61 'title': 'Patti LaBelle -- Goes Nuclear On Stripping Fan',
62 'description': 'Patti LaBelle made it known loud and clear last night ... NO '
63 'ONE gets on her stage and strips down.',
64 'timestamp': 1442683746,
65 'uploader': 'TMZ Staff',
66 'upload_date': '20150919',
68 'thumbnail': 'https://imagez.tmz.com/image/5e/4by3/2015/09/20/5e57d7575062528082994e18ac3f0f48_xl.jpg',
72 'url': 'http://www.tmz.com/2016/01/28/adam-silver-sting-drake-blake-griffin/',
74 'id': 'http://www.tmz.com/2016/01/28/adam-silver-sting-drake-blake-griffin/',
76 'title': 'NBA\'s Adam Silver -- Blake Griffin\'s a Great Guy ... He\'ll Learn from This',
77 'description': 'Two pretty parts of this video with NBA Commish Adam Silver.',
78 'timestamp': 1454010989,
79 'uploader': 'TMZ Staff',
80 'upload_date': '20160128',
82 'thumbnail': 'https://imagez.tmz.com/image/38/4by3/2016/01/29/3856e83e0beb57059ec412122b842fb1_xl.jpg',
86 'url': 'http://www.tmz.com/2016/10/27/donald-trump-star-vandal-arrested-james-otis/',
88 'id': 'http://www.tmz.com/2016/10/27/donald-trump-star-vandal-arrested-james-otis/',
90 'title': 'Trump Star Vandal -- I\'m Not Afraid of Donald or the Cops!',
91 'description': 'James Otis is the the guy who took a pickaxe to Donald Trump\'s star on the Walk of Fame, and he tells TMZ .. he\'s ready and willing to go to jail for the crime.',
92 'timestamp': 1477500095,
93 'uploader': 'TMZ Staff',
94 'upload_date': '20161026',
95 'thumbnail': 'https://imagez.tmz.com/image/0d/4by3/2016/10/27/0d904814d4a75dcf9cc3b8cfd1edc1a3_xl.jpg',
100 'url': 'https://www.tmz.com/videos/2020-10-31-103120-beverly-hills-protest-4878209/',
102 'id': 'https://www.tmz.com/videos/2020-10-31-103120-beverly-hills-protest-4878209/',
104 'title': 'Cops Use Billy Clubs Against Pro-Trump and Anti-Fascist '
106 'description': 'Beverly Hills may be an omen of what\'s coming next week, '
107 'because things got crazy on the streets and cops started '
108 'swinging their billy clubs at both Anti-Fascist and Pro-Trump '
110 'timestamp': 1604182772,
111 'uploader': 'TMZ Staff',
112 'upload_date': '20201031',
114 'thumbnail': 'https://imagez.tmz.com/image/f3/4by3/2020/10/31/f37bd5a8aef84497866f425130c58be3_xl.jpg',
118 'url': 'https://www.tmz.com/2020/11/05/gervonta-davis-car-crash-hit-and-run-police/',
122 'title': 'SICK LAMBO GERVONTA DAVIS IN HIS NEW RIDE RIGHT AFTER KO AFTER LEO EsNews Boxing',
123 'uploader': 'ESNEWS',
124 'description': 'md5:49675bc58883ccf80474b8aa701e1064',
125 'upload_date': '20201102',
126 'uploader_id': '@ESNEWS',
127 'uploader_url': 'https://www.youtube.com/@ESNEWS',
129 'channel_id': 'UCI-Oq7oFGakzSzHFlTtsUsQ',
133 'live_status': 'not_live',
134 'thumbnail': 'https://i.ytimg.com/vi_webp/Dddb6IGe-ws/maxresdefault.webp',
135 'channel_url': 'https://www.youtube.com/channel/UCI-Oq7oFGakzSzHFlTtsUsQ',
136 'channel_follower_count': int,
137 'playable_in_embed': True,
138 'categories': ['Sports'],
141 'availability': 'public',
142 'comment_count': int,
146 'url': 'https://www.tmz.com/2020/11/19/conor-mcgregor-dustin-poirier-contract-fight-ufc-257-fight-island/',
148 'id': '1329448013937471491',
150 'title': 'The Mac Life - BREAKING: Conor McGregor (@thenotoriousmma) has signed his bout agreement for his rematch with Dustin Poirier for January 23.',
151 'uploader': 'The Mac Life',
152 'description': 'md5:56e6009bbc3d12498e10d08a8e1f1c69',
153 'upload_date': '20201119',
154 'display_id': '1329450007125225473',
155 'uploader_id': 'TheMacLife',
156 'timestamp': 1605800556,
157 'thumbnail': 'https://pbs.twimg.com/media/EnMmfT8XYAExgxJ.jpg?name=small',
160 'uploader_url': 'https://twitter.com/TheMacLife',
164 'comment_count': int,
169 def _real_extract(self
, url
):
170 webpage
= self
._download
_webpage
(url
, url
)
171 jsonld
= self
._search
_json
_ld
(webpage
, url
)
172 if not jsonld
or 'url' not in jsonld
:
173 # try to extract from YouTube Player API
174 # see https://developers.google.com/youtube/iframe_api_reference#Video_Queueing_Functions
175 match_obj
= re
.search(r
'\.cueVideoById\(\s*(?P<quote>[\'"])(?P<id>.*?)(?P=quote)', webpage)
177 res = self.url_result(match_obj.group('id'))
179 # try to extract from twitter
180 blockquote_el = get_element_by_attribute('class', 'twitter-tweet', webpage)
182 matches = re.findall(
183 r'<a[^>]+href=\s*(?P<quote>[\'"])(?P
<link
>.*?
)(?P
=quote
)',
186 for _, match in matches:
187 if '/status
/' in match:
188 res = self.url_result(match)
190 raise ExtractorError('No video found
!')