Repository: yt-dlp/yt-dlp

Issue:
Facebook uploader no longer detected
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.04.08** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

US

### Description

I'm trying to download a video from Facebook and the uploader name is no longer being set properly:

Using this test URL starting at line 146 in facebook.py extractor:
https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/facebook.py#L146

>         'url': 'https://www.facebook.com/cnn/videos/10155529876156509/',
>         'md5': '3f3798adb2b73423263e59376f1f5eb7',
>         'info_dict': {
>             'id': '10155529876156509',
>             'ext': 'mp4',
>             'title': 'Holocaust survivor becomes US citizen',
>             'description': 'She survived the holocaust — and years later, she’s getting her citizenship so she can vote for Hillary Clinton http://cnn.it/2eERh5f',
>             'timestamp': 1477818095,
>             'upload_date': '20161030',
>             'uploader': 'CNN',
>             'thumbnail': r're:^https?://.*',
>             'view_count': int,
>         },
> 

With output set to:
%(uploader)s - %(title)s - (%(upload_date)s) - (Facebook:%(id)s).%(ext)s

The filename becomes this (uploader has the title instead of uploader name):
Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv

Expected result:
CNN - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv

### Verbose log

```shell
python3 D:\Audacity\_youtube\yt-dlp-20220408 --newline -i --hls-prefer-native --write-description --write-info-json --write-annotations --cookies D:/Audacity/_youtube/cookies.txt --write-thumbnail --merge-output-format mkv --write-sub --embed-thumbnail --add-metadata --convert-thumbnails jpg --sub-lang en --output D:/Audacity/_youtube/Unsorted Videos/%(uploader)s - %(title)s - (%(upload_date)s) - (Facebook:%(id)s).%(ext)s --verbose --get-comments --extractor-args youtube:comment_sort=top -f bestvideo[ext=webm][height<=?480][fps<=?30]+bestaudio[ext=webm]/bestvideo[height<=?480][fps<=?30]+bestaudio/best https://www.facebook.com/cnn/videos/10155529876156509/
[debug] Command-line config: ['--newline', '-i', '--hls-prefer-native', '--write-description', '--write-info-json', '--write-annotations', '--cookies', 'D:/Audacity/_youtube/cookies.txt', '--write-thumbnail', '--merge-output-format', 'mkv', '--write-sub', '--embed-thumbnail', '--add-metadata', '--convert-thumbnails', 'jpg', '--sub-lang', 'en', '--output', 'D:/Audacity/_youtube/Unsorted Videos/%(uploader)s - %(title)s - (%(upload_date)s) - (Facebook:%(id)s).%(ext)s', '--verbose', '--get-comments', '--extractor-args', 'youtube:comment_sort=top', '-f', 'bestvideo[ext=webm][height<=?480][fps<=?30]+bestaudio[ext=webm]/bestvideo[height<=?480][fps<=?30]+bestaudio/best', 'https://www.facebook.com/cnn/videos/10155529876156509/']
[debug] Encodings: locale cp1252, fs utf-8, out cp1252 (No ANSI), err cp1252 (No ANSI), pref cp1252
[debug] yt-dlp version 2022.04.08 [7884ade65] (zip)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Python version 3.9.10 (CPython 64bit) - Windows-10-10.0.17763-SP0
[debug] Checking exe version: ffprobe -bsfs
[debug] Optional libraries: certifi, sqlite
[debug] Proxy map: ()
[debug] exe versions: ffmpeg 4.4.1 (setts), ffprobe 4.4.1, rtmpdump 2.4
[debug] [facebook] Extracting URL: https://www.facebook.com/cnn/videos/10155529876156509/
[facebook] 10155529876156509: Downloading webpage
[facebook] 10155529876156509: Downloading MPD manifest
[debug] Formats sorted by: hasvid, ie_pref, res, quality, lang, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Sort order given by extractor: res, quality
[info] 10155529876156509: Downloading 1 format(s): 1177720656306079v-1+10155529878241509a-1
[info] Writing video description to: D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).description
[info] Downloading video thumbnail 0 ...
[info] Writing video thumbnail 0 to: D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).jpg
[info] Writing video metadata as JSON to: D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).info.json
WARNING: There are no annotations to write.
[ThumbnailsConvertor] Thumbnail "D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).jpg" is already in the requested format
[debug] Invoking downloader on "https://video-dfw5-2.xx.fbcdn.net/v/t39.25447-2/277815221_2076957485809219_6892685728564347132_n.mp4?_nc_cat=102&ccb=1-5&_nc_sid=5aebc0&efg=eyJ2ZW5jb2RlX3RhZyI6ImRhc2hfaTRsaXRlYmFzaWNfNXNlY2dvcF80ODBfY3JmXzI4X21haW5fMy4wX2ZyYWdfMl92aWRlbyJ9&_nc_ohc=urRnsvOe49EAX-RtJEQ&_nc_ht=video-dfw5-2.xx&oh=00_AT-Y3wPgw7L4ZmpWQy9shF1oT8hmLmpHQ4jF0o-95mreMA&oe=625D61C6"
[debug] File locking is not supported on this platform. Proceeding without locking
[download] Destination: D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).f1177720656306079v-1.mp4
[download] 100% of 1.25MiB in 00:00
[debug] Invoking downloader on "https://video-dfw5-1.xx.fbcdn.net/v/t42.1790-2/14926769_10155529878251509_3232337965438992384_n.mp4?_nc_cat=111&ccb=1-5&_nc_sid=5aebc0&efg=eyJ2ZW5jb2RlX3RhZyI6ImRhc2hfdjNfNDI2X2NyZl8yM19tYWluXzMuMF9mcmFnXzJfYXVkaW8ifQ==&_nc_ohc=_FKGnS3Az-gAX986tt7&_nc_ht=video-dfw5-1.xx&oh=00_AT-WYmXLLIMMhxKQhGBvyrYkx8UicgJYrwEebeyRlDes8g&oe=6258D5B8"
[download] Destination: D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).f10155529878241509a-1.m4a
[download] 100% of 267.33KiB in 00:00
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).f1177720656306079v-1.mp4" -i "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).f10155529878241509a-1.m4a" -c copy -map "0:v:0" -map "1:a:0" -movflags "+faststart" "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).temp.mkv"
[Merger] Merging formats into "D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv"
Deleting original file D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).f1177720656306079v-1.mp4 (pass -k to keep)
Deleting original file D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).f10155529878241509a-1.m4a (pass -k to keep)
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv"
[Metadata] Adding metadata to "D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Holocaust survivor becomes US citizen" -metadata "date=20161030" -metadata "description=She survived the holocaust — and years later, she’s getting her citizenship so she can vote for Hillary Clinton http://cnn.it/2eERh5f" -metadata "synopsis=She survived the holocaust — and years later, she’s getting her citizenship so she can vote for Hillary Clinton http://cnn.it/2eERh5f" -metadata "purl=https://www.facebook.com/cnn/videos/10155529876156509/" -metadata "comment=https://www.facebook.com/cnn/videos/10155529876156509/" -metadata "artist=Holocaust survivor becomes US citizen" "-metadata:s:1" "language=eng" -attach "D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).info.json" "-metadata:s:2" "mimetype=application/json" -movflags "+faststart" "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).temp.mkv"
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv" -map 0 -dn -ignore_unknown -c copy -attach "D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).jpg" "-metadata:s:3" "mimetype=image/jpeg" "-metadata:s:3" "filename=cover.jpg" -movflags "+faststart" "file:D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).temp.mkv"
[EmbedThumbnail] ffmpeg: Adding thumbnail to "D:/Audacity/_youtube/Unsorted Videos/Holocaust survivor becomes US citizen - Holocaust survivor becomes US citizen - (20161030) - (Facebook#10155529876156509).mkv"
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/facebook.py b/yt_dlp/extractor/facebook.py
--- a/yt_dlp/extractor/facebook.py
+++ b/yt_dlp/extractor/facebook.py
@@ -390,7 +390,10 @@ def extract_metadata(webpage):
                 k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict)
             title = get_first(media, ('title', 'text'))
             description = get_first(media, ('creation_story', 'comet_sections', 'message', 'story', 'message', 'text'))
-            uploader_data = get_first(media, 'owner') or get_first(post, ('node', 'actors', ...)) or {}
+            uploader_data = (
+                get_first(media, ('owner', {dict}))
+                or get_first(post, (..., 'video', lambda k, v: k == 'owner' and v['name']))
+                or get_first(post, ('node', 'actors', ..., {dict})) or {})
 
             page_title = title or self._html_search_regex((
                 r'<h2\s+[^>]*class="uiHeaderTitle"[^>]*>(?P<content>[^<]*)</h2>',
@@ -415,16 +418,17 @@ def extract_metadata(webpage):
             # in https://www.facebook.com/yaroslav.korpan/videos/1417995061575415/
             if thumbnail and not re.search(r'\.(?:jpg|png)', thumbnail):
                 thumbnail = None
-            view_count = parse_count(self._search_regex(
-                r'\bviewCount\s*:\s*["\']([\d,.]+)', webpage, 'view count',
-                default=None))
             info_dict = {
                 'description': description,
                 'uploader': uploader,
                 'uploader_id': uploader_data.get('id'),
                 'timestamp': timestamp,
                 'thumbnail': thumbnail,
-                'view_count': view_count,
+                'view_count': parse_count(self._search_regex(
+                    (r'\bviewCount\s*:\s*["\']([\d,.]+)', r'video_view_count["\']\s*:\s*(\d+)',),
+                    webpage, 'view count', default=None)),
+                'concurrent_view_count': get_first(post, (
+                    ('video', (..., ..., 'attachments', ..., 'media')), 'liveViewerCount', {int_or_none})),
             }
 
             info_json_ld = self._search_json_ld(webpage, video_id, default={})


Test patch: