Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 913113 | Differences between
and this patch

Collapse All | Expand All

(-)a/yt_dlp/extractor/facebook.py (-20 / +32 lines)
Lines 24-29 Link Here
24
    parse_count,
24
    parse_count,
25
    parse_qs,
25
    parse_qs,
26
    qualities,
26
    qualities,
27
    sanitized_Request,
27
    sanitized_Request,
28
    str_or_none,
28
    traverse_obj,
29
    traverse_obj,
29
    try_get,
30
    try_get,
30
    url_or_none,
31
    url_or_none,
Lines 151-157 class FacebookIE(InfoExtractor): Link Here
151
        # have 1080P, but only up to 720p in swf params
152
        # have 1080P, but only up to 720p in swf params
152
        # data.video.story.attachments[].media
153
        # data.video.story.attachments[].media
153
        'url': 'https://www.facebook.com/cnn/videos/10155529876156509/',
154
        'url': 'https://www.facebook.com/cnn/videos/10155529876156509/',
154
        'md5': '3f3798adb2b73423263e59376f1f5eb7',
155
        'md5': 'ca63897a90c9452efee5f8c40d080e25',
155
        'info_dict': {
156
        'info_dict': {
156
            'id': '10155529876156509',
157
            'id': '10155529876156509',
157
            'ext': 'mp4',
158
            'ext': 'mp4',
Lines 162-167 class FacebookIE(InfoExtractor): Link Here
162
            'uploader': 'CNN',
163
            'uploader': 'CNN',
163
            'thumbnail': r're:^https?://.*',
164
            'thumbnail': r're:^https?://.*',
164
            'view_count': int,
165
            'view_count': int,
166
            'uploader_id': '100059479812265',
167
            'concurrent_view_count': int,
168
            'duration': 44.478,
165
        },
169
        },
166
    }, {
170
    }, {
167
        # bigPipe.onPageletArrive ... onPageletArrive pagelet_group_mall
171
        # bigPipe.onPageletArrive ... onPageletArrive pagelet_group_mall
Lines 192-200 class FacebookIE(InfoExtractor): Link Here
192
            'uploader': 'La Guía Del Varón',
200
            'uploader': 'La Guía Del Varón',
193
            'thumbnail': r're:^https?://.*',
201
            'thumbnail': r're:^https?://.*',
194
        },
202
        },
195
        'params': {
203
        'skip': 'Requires logging in',
196
            'skip_download': True,
197
        },
198
    }, {
204
    }, {
199
        # data.node.comet_sections.content.story.attachments[].style_type_renderer.attachment.media
205
        # data.node.comet_sections.content.story.attachments[].style_type_renderer.attachment.media
200
        'url': 'https://www.facebook.com/groups/1024490957622648/permalink/1396382447100162/',
206
        'url': 'https://www.facebook.com/groups/1024490957622648/permalink/1396382447100162/',
Lines 208-216 class FacebookIE(InfoExtractor): Link Here
208
            'uploader': 'Elisabeth Ahtn',
214
            'uploader': 'Elisabeth Ahtn',
209
            'uploader_id': '100013949973717',
215
            'uploader_id': '100013949973717',
210
        },
216
        },
211
        'params': {
217
        'skip': 'Requires logging in',
212
            'skip_download': True,
213
        },
214
    }, {
218
    }, {
215
        'url': 'https://www.facebook.com/video.php?v=10204634152394104',
219
        'url': 'https://www.facebook.com/video.php?v=10204634152394104',
216
        'only_matching': True,
220
        'only_matching': True,
Lines 252-258 class FacebookIE(InfoExtractor): Link Here
252
            'timestamp': 1527084179,
256
            'timestamp': 1527084179,
253
            'upload_date': '20180523',
257
            'upload_date': '20180523',
254
            'uploader': 'ESL One Dota 2',
258
            'uploader': 'ESL One Dota 2',
255
            'uploader_id': '234218833769558',
259
            'uploader_id': '100066514874195',
260
            'duration': 4524.212,
261
            'view_count': int,
262
            'thumbnail': r're:^https?://.*',
263
            'concurrent_view_count': int,
256
        },
264
        },
257
        'params': {
265
        'params': {
258
            'skip_download': True,
266
            'skip_download': True,
Lines 276-281 class FacebookIE(InfoExtractor): Link Here
276
            'id': '10157667649866271',
293
            'id': '10157667649866271',
277
        },
294
        },
278
        'playlist_count': 3,
295
        'playlist_count': 3,
296
        'skip': 'Requires logging in',
279
    }, {
297
    }, {
280
        # data.nodes[].comet_sections.content.story.attachments[].style_type_renderer.attachment.media
298
        # data.nodes[].comet_sections.content.story.attachments[].style_type_renderer.attachment.media
281
        'url': 'https://m.facebook.com/Alliance.Police.Department/posts/4048563708499330',
299
        'url': 'https://m.facebook.com/Alliance.Police.Department/posts/4048563708499330',
Lines 497-502 def extract_relay_prefetched_data(_filter): Link Here
497
                entries = []
515
                entries = []
498
516
499
                def parse_graphql_video(video):
517
                def parse_graphql_video(video):
518
                    v_id = video.get('videoId') or video.get('id') or video_id
519
                    reel_info = traverse_obj(
520
                        video, ('creation_story', 'short_form_video_context', 'playback_video', {dict}))
521
                    if reel_info:
522
                        video = video['creation_story']
523
                        video['owner'] = traverse_obj(video, ('short_form_video_context', 'video_owner'))
524
                        video.update(reel_info)
500
                    formats = []
525
                    formats = []
501
                    q = qualities(['sd', 'hd'])
526
                    q = qualities(['sd', 'hd'])
502
                    for key, format_id in (('playable_url', 'sd'), ('playable_url_quality_hd', 'hd'),
527
                    for key, format_id in (('playable_url', 'sd'), ('playable_url_quality_hd', 'hd'),
Lines 513-527 def parse_graphql_video(video): Link Here
513
                                'url': playable_url,
538
                                'url': playable_url,
514
                            })
539
                            })
515
                    extract_dash_manifest(video, formats)
540
                    extract_dash_manifest(video, formats)
516
                    v_id = video.get('videoId') or video.get('id') or video_id
517
                    info = {
541
                    info = {
518
                        'id': v_id,
542
                        'id': v_id,
519
                        'formats': formats,
543
                        'formats': formats,
520
                        'thumbnail': traverse_obj(
544
                        'thumbnail': traverse_obj(
521
                            video, ('thumbnailImage', 'uri'), ('preferred_thumbnail', 'image', 'uri')),
545
                            video, ('thumbnailImage', 'uri'), ('preferred_thumbnail', 'image', 'uri')),
522
                        'uploader_id': try_get(video, lambda x: x['owner']['id']),
546
                        'uploader_id': traverse_obj(video, ('owner', 'id', {str_or_none})),
523
                        'timestamp': int_or_none(video.get('publish_time')),
547
                        'timestamp': traverse_obj(video, 'publish_time', 'creation_time', expected_type=int_or_none),
524
                        'duration': float_or_none(video.get('playable_duration_in_ms'), 1000),
548
                        'duration': (float_or_none(video.get('playable_duration_in_ms'), 1000)
549
                                     or float_or_none(video.get('length_in_second'))),
525
                    }
550
                    }
526
                    process_formats(info)
551
                    process_formats(info)
527
                    description = try_get(video, lambda x: x['savable_description']['text'])
552
                    description = try_get(video, lambda x: x['savable_description']['text'])
Lines 782-799 class FacebookReelIE(InfoExtractor): Link Here
782
807
783
    _TESTS = [{
808
    _TESTS = [{
784
        'url': 'https://www.facebook.com/reel/1195289147628387',
809
        'url': 'https://www.facebook.com/reel/1195289147628387',
785
        'md5': 'c4ff9a7182ff9ff7d6f7a83603bae831',
810
        'md5': 'f13dd37f2633595982db5ed8765474d3',
786
        'info_dict': {
811
        'info_dict': {
787
            'id': '1195289147628387',
812
            'id': '1195289147628387',
788
            'ext': 'mp4',
813
            'ext': 'mp4',
789
            'title': 'md5:9f5b142921b2dc57004fa13f76005f87',
814
            'title': 'md5:b05800b5b1ad56c0ca78bd3807b6a61e',
790
            'description': 'md5:24ea7ef062215d295bdde64e778f5474',
815
            'description': 'md5:22f03309b216ac84720183961441d8db',
791
            'uploader': 'Beast Camp Training',
816
            'uploader': 'md5:723e6cb3091241160f20b3c5dc282af1',
792
            'uploader_id': '1738535909799870',
817
            'uploader_id': '100040874179269',
793
            'duration': 9.536,
818
            'duration': 9.579,
794
            'thumbnail': r're:^https?://.*',
819
            'timestamp': 1637502609,
795
            'upload_date': '20211121',
820
            'upload_date': '20211121',
796
            'timestamp': 1637502604,
821
            'thumbnail': r're:^https?://.*',
797
        }
822
        }
798
    }]
823
    }]
799
824

Return to bug 913113