Repository: yt-dlp
Issue: [Instagram] Incorrect/missing metadata when downloading video posts
Labels: site-enhancement

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I'm running yt-dlp version **2023.10.13** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#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 [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and 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)
- [ ] 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

Canada

### Provide a description that is worded well enough to be understood

What I'm trying to do is archive an Instagram post that has one or more videos as part of the post. I've noticed that some output template fields (metadata fields? apologies if I'm not getting the terminology right) output "NA" when they shouldn't. I'm most concerned about fields related to the uploader (or the Instagram account that posted the post) and the upload date (or post date, if upload date is unavailable), so those are the only fields that I'm aware of that are missing:

- `playlist_uploader`
- `channel`
- `uploader`
- `creator`
- `upload_date`

It's very odd. The `channel` and `uploader` fields in particular output as "NA", yet I can see the username is included in the output of the `title` field! For example: `title` outputs "Post by \<username\>", yet the `channel` and `uploader` fields, on the same video, will output "NA".

To my understanding, the Instagram extractor treats Instagram posts as playlists. Maybe there's something amiss with the Instagram playlist extractor? I suggest this because I have archived other Instagram content - mostly reels - and haven't experienced missing output template fields for that type of content.

---

My output templates from `yt-dlp.conf`:

```
--output             "%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s"
--output "description:%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s"
--output    "infojson:%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s"

--output "pl_description:%(title)s [@%(playlist_uploader,channel,uploader,creator)s] [%(playlist_id)s]"
--output    "pl_infojson:%(title)s [@%(playlist_uploader,channel,uploader,creator)s] [%(playlist_id)s]"
```

<details>
<summary>Click to see yt-dlp output from downloading a reel, which demonstrates output template fields in this context have their proper contents</summary>

```sh
BK@BK-DESKTOP MINGW64 ~/Desktop/temp
$ yt-dlp -v
[debug] Command-line config: ['-v']
[debug] Home config "yt-dlp.conf": ['--verbose', '--progress', '--sleep-requests', '2', '--min-sleep-interval', '3', '--max-sleep-interval', '15', '--rate-limit', '3M', '--batch-file', 'download.txt', '--no-mtime', '--download-archive', 'archive.log', '--match-filter', '!is_live & !live', '--check-formats', '--merge-output-format', 'mp4', '--embed-thumbnail', '--embed-metadata', '--embed-chapters', '--embed-subs', '--parse-metadata', '%(playlist_title&{} - |)s%(title)s:%(meta_title)s', '--parse-metadata', '%(playlist_uploader,uploader,creator,channel)s:%(meta_artist)s', '--parse-metadata', '%(upload_date>%Y-%m-%d)s:%(meta_date)s', '--write-description', '--write-info-json', '--write-playlist-metafile', '--output', '%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s', '--output', 'description:%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s', '--output', 'infojson:%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s', '--output', 'pl_description:%(title)s [@%(playlist_uploader,channel,uploader,creator)s] [%(playlist_id)s]', '--output', 'pl_infojson:%(title)s [@%(playlist_uploader,channel,uploader,creator)s] [%(playlist_id)s]']
[debug] Batch file urls: ['https://www.instagram.com/reel/CxbchM7OcH5/']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8 
[debug] yt-dlp version stable@2023.10.13 [b634ba742] (source) 
[debug] Lazy loading extractors is disabled
[debug] Git HEAD: 4e38e2ae9 
[debug] Python 3.12.0 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 3.0.11 19 Sep 2023) 
[debug] exe versions: ffmpeg 6.0-full_build-www.gyan.dev (setts), ffprobe 6.0-full_build-www.gyan.dev 
[debug] Optional libraries: Cryptodome-3.19.0, brotli-1.1.0, certifi-2023.07.22, mutagen-1.47.0, sqlite3-3.42.0, websockets-12.0 
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Loaded 1890 extractors 
[debug] Loading archive file 'archive.log' 
[Instagram] Extracting URL: https://www.instagram.com/reel/CxbchM7OcH5/ 
[Instagram] CxbchM7OcH5: Setting up session 
[Instagram] Sleeping 2.0 seconds ... 
[Instagram] CxbchM7OcH5: Downloading JSON metadata 
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id 
[debug] Searching for '(?P<meta_title>.+)' in '%(playlist_title&{} - |)s%(title)s' 
[MetadataParser] Parsed meta_title from '%(playlist_title&{} - |)s%(title)s': 'Video by mcdonaldsfudgesundae'
[debug] Searching for '(?P<meta_artist>.+)' in '%(playlist_uploader,uploader,creator,channel)s'
[MetadataParser] Parsed meta_artist from '%(playlist_uploader,uploader,creator,channel)s': 'mcdonaldsfudgesundae'
[debug] Searching for '(?P<meta_date>.+)' in '%(upload_date>%Y-%m-%d)s'
[MetadataParser] Parsed meta_date from '%(upload_date>%Y-%m-%d)s': '2023-09-20'
[debug] Default format spec: bestvideo*+bestaudio/best
[info] Testing format 0
[debug] File locking is not supported. Proceeding without locking 
[download] Destination: C:\Users\BK\Desktop\temp\tmpjdxwke81.tmp 
[download] 100% of   10.00KiB in 00:00:00 at 104.48KiB/s
[info] Testing format 0
[download] Destination: C:\Users\BK\Desktop\temp\tmpiwm_1xq_.tmp 
[download] 100% of   10.00KiB in 00:00:00 at 163.05KiB/s
[info] CxbchM7OcH5: Downloading 1 format(s): 0
[info] Writing video description to: Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].description
[info] There are no subtitles for the requested languages
[info] Downloading video thumbnail 2 ...
[info] Writing video thumbnail 2 to: Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].jpg 
[info] Writing video metadata as JSON to: Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].info.json 
[debug] Invoking http downloader on "https://instagram.fyxd3-1.fna.fbcdn.net/v/t50.2886-16/380462643_598163488952569_1026106922257174065_n.mp4?_nc_ht=instagram.fyxd3-1.fna.fbcdn.net&_nc_cat=101&_nc_ohc=CY_06e-rbVQAX9xNwIf&edm=AP_V10EBAAAA&ccb=7-5&oh=00_AfDkTJ40Eo_ikpj3Cm-lyJwK6GnbyrN614WN6vpmr11xLw&oe=6536B1C4&_nc_sid=2999b8"
[download] Sleeping 6.84 seconds ...
[download] Destination: Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].mp4 
[download] 100% of    1.07MiB in 00:00:00 at 2.57MiB/s
[EmbedSubtitle] There aren't any subtitles to embed
[Metadata] Adding metadata to "Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].mp4" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Video by mcdonaldsfudgesundae" -metadata "date=2023-09-20" -metadata "description=Silly Cat Names on PetFinder Part 10 #cats #sillycats" -metadata "synopsis=Silly Cat Names on PetFinder Part 10 #cats #sillycats" -metadata "purl=https://www.instagram.com/reel/CxbchM7OcH5/" -metadata "comment=https://www.instagram.com/reel/CxbchM7OcH5/" -metadata "artist=mcdonaldsfudgesundae" -movflags "+faststart" "file:Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].temp.mp4"
[EmbedThumbnail] mutagen: Adding thumbnail to "Video by mcdonaldsfudgesundae [@mcdonaldsfudgesundae] [CxbchM7OcH5].mp4" 
[debug] Adding to archive: instagram CxbchM7OcH5
```
</details>

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
BK@BK-DESKTOP MINGW64 ~/Desktop/temp
$ yt-dlp -v
[debug] Command-line config: ['-v']
[debug] Home config "yt-dlp.conf": ['--verbose', '--progress', '--sleep-requests', '2', '--min-sleep-interval', '3', '--max-sleep-interval', '15', '--rate-limit', '3M', '--batch-file', 'download.txt', '--no-mtime', '--download-archive', 'archive.log', '--match-filter', '!is_live & !live', '--check-formats', '--merge-output-format', 'mp4', '--embed-thumbnail', '--embed-metadata', '--embed-chapters', '--embed-subs', '--parse-metadata', '%(playlist_title&{} - |)s%(title)s:%(meta_title)s', '--parse-metadata', '%(playlist_uploader,uploader,creator,channel)s:%(meta_artist)s', '--parse-metadata', '%(upload_date>%Y-%m-%d)s:%(meta_date)s', '--write-description', '--write-info-json', '--write-playlist-metafile', '--output', '%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s', '--output', 'description:%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s', '--output', 'infojson:%(playlist_title&{} - |)s%(title)s [@%(playlist_uploader,channel,uploader,creator)s]%(playlist_id& [{}]|)s [%(id)s].%(ext)s', '--output', 'pl_description:%(title)s [@%(playlist_uploader,channel,uploader,creator)s] [%(playlist_id)s]', '--output', 'pl_infojson:%(title)s [@%(playlist_uploader,channel,uploader,creator)s] [%(playlist_id)s]']
[debug] Batch file urls: ['https://www.instagram.com/p/CyeOWE-pl7s/']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8 
[debug] yt-dlp version stable@2023.10.13 [b634ba742] (source) 
[debug] Lazy loading extractors is disabled
[debug] Git HEAD: 4e38e2ae9 
[debug] Python 3.12.0 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 3.0.11 19 Sep 2023) 
[debug] exe versions: ffmpeg 6.0-full_build-www.gyan.dev (setts), ffprobe 6.0-full_build-www.gyan.dev 
[debug] Optional libraries: Cryptodome-3.19.0, brotli-1.1.0, certifi-2023.07.22, mutagen-1.47.0, sqlite3-3.42.0, websockets-12.0 
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Loaded 1890 extractors 
[debug] Loading archive file 'archive.log' 
[Instagram] Extracting URL: https://www.instagram.com/p/CyeOWE-pl7s/ 
[Instagram] CyeOWE-pl7s: Setting up session 
[Instagram] Sleeping 2.0 seconds ... 
[Instagram] CyeOWE-pl7s: Downloading JSON metadata 
[download] Downloading playlist: Post by sweetcatworldd 
[info] Writing playlist metadata as JSON to: Post by sweetcatworldd [@NA] [CyeOWE-pl7s].info.json 
[info] Writing playlist description to: Post by sweetcatworldd [@NA] [CyeOWE-pl7s].description
[info] There are no playlist thumbnails to download
[Instagram] Playlist Post by sweetcatworldd: Downloading 2 items of 2
[download] Downloading item 1 of 2
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Searching for '(?P<meta_title>.+)' in '%(playlist_title&{} - |)s%(title)s' 
[MetadataParser] Parsed meta_title from '%(playlist_title&{} - |)s%(title)s': 'Post by sweetcatworldd - Video 1'
[debug] Searching for '(?P<meta_artist>.+)' in '%(playlist_uploader,uploader,creator,channel)s'
[MetadataParser] Parsed meta_artist from '%(playlist_uploader,uploader,creator,channel)s': 'NA'
[debug] Searching for '(?P<meta_date>.+)' in '%(upload_date>%Y-%m-%d)s'
[MetadataParser] Parsed meta_date from '%(upload_date>%Y-%m-%d)s': 'NA'
[debug] Default format spec: bestvideo*+bestaudio/best
[info] Testing format 0
[debug] File locking is not supported. Proceeding without locking 
[download] Destination: C:\Users\BK\Desktop\temp\tmprp3pdc66.tmp 
[download] 100% of   10.00KiB in 00:00:00 at 158.78KiB/s
[info] Testing format 0
[download] Destination: C:\Users\BK\Desktop\temp\tmp91_cntww.tmp 
[download] 100% of   10.00KiB in 00:00:00 at 129.88KiB/s
[info] CyeOSHgJK_B: Downloading 1 format(s): 0
[info] There's no video description to write
[info] There are no subtitles for the requested languages 
[info] Downloading video thumbnail 0 ...
[info] Writing video thumbnail 0 to: Post by sweetcatworldd - Video 1 [@NA] [CyeOWE-pl7s] [CyeOSHgJK_B].jpg 
[info] Writing video metadata as JSON to: Post by sweetcatworldd - Video 1 [@NA] [CyeOWE-pl7s] [CyeOSHgJK_B].info.json 
[debug] Invoking http downloader on "https://instagram.fyxd3-1.fna.fbcdn.net/v/t50.2886-16/392476666_863004988769869_1016171325371388146_n.mp4?_nc_ht=instagram.fyxd3-1.fna.fbcdn.net&_nc_cat=101&_nc_ohc=tqZM-qw-H14AX9WgOgR&edm=AP_V10EBAAAA&ccb=7-5&oh=00_AfBDldFmpmSOP76HPB6BrRi7Cfnbi3ykjHk7__-ivp-OXQ&oe=65369E1E&_nc_sid=2999b8"
[download] Sleeping 8.82 seconds ...
[download] Destination: Post by sweetcatworldd - Video 1 [@NA] [CyeOWE-pl7s] [CyeOSHgJK_B].mp4 
[download] 100% of    1.57MiB in 00:00:00 at 2.63MiB/s
[EmbedSubtitle] There aren't any subtitles to embed
[Metadata] Adding metadata to "Post by sweetcatworldd - Video 1 [@NA] [CyeOWE-pl7s] [CyeOSHgJK_B].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Post by sweetcatworldd - Video 1 [@NA] [CyeOWE-pl7s] [CyeOSHgJK_B].mp4" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Post by sweetcatworldd - Video 1" -metadata "purl=https://www.instagram.com/p/CyeOWE-pl7s/" -metadata "comment=https://www.instagram.com/p/CyeOWE-pl7s/" -metadata "artist=NA" -metadata "date=NA" -movflags "+faststart" "file:Post by sweetcatworldd - Video 1 [@NA] [CyeOWE-pl7s] [CyeOSHgJK_B].temp.mp4"
[EmbedThumbnail] mutagen: Adding thumbnail to "Post by sweetcatworldd - Video 1 [@NA] [CyeOWE-pl7s] [CyeOSHgJK_B].mp4" 
[debug] Adding to archive: instagram CyeOSHgJK_B 
[download] Downloading item 2 of 2 
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id 
[debug] Searching for '(?P<meta_title>.+)' in '%(playlist_title&{} - |)s%(title)s'
[MetadataParser] Parsed meta_title from '%(playlist_title&{} - |)s%(title)s': 'Post by sweetcatworldd - Video 2'
[debug] Searching for '(?P<meta_artist>.+)' in '%(playlist_uploader,uploader,creator,channel)s'
[MetadataParser] Parsed meta_artist from '%(playlist_uploader,uploader,creator,channel)s': 'NA'
[debug] Searching for '(?P<meta_date>.+)' in '%(upload_date>%Y-%m-%d)s'
[MetadataParser] Parsed meta_date from '%(upload_date>%Y-%m-%d)s': 'NA'
[debug] Default format spec: bestvideo*+bestaudio/best
[info] Testing format 0 
[download] Destination: C:\Users\BK\Desktop\temp\tmpjgfyedkw.tmp 
[download] 100% of   10.00KiB in 00:00:00 at 166.92KiB/s
[info] Testing format 0
[download] Destination: C:\Users\BK\Desktop\temp\tmpfjiih3bz.tmp 
[download] 100% of   10.00KiB in 00:00:00 at 185.21KiB/s
[info] CyeOSIWp8CP: Downloading 1 format(s): 0
[info] There's no video description to write
[info] There are no subtitles for the requested languages
[info] Downloading video thumbnail 0 ...
[info] Writing video thumbnail 0 to: Post by sweetcatworldd - Video 2 [@NA] [CyeOWE-pl7s] [CyeOSIWp8CP].jpg 
[info] Writing video metadata as JSON to: Post by sweetcatworldd - Video 2 [@NA] [CyeOWE-pl7s] [CyeOSIWp8CP].info.json 
[debug] Invoking http downloader on "https://instagram.fyxd3-1.fna.fbcdn.net/v/t50.2886-16/392497122_1524325414981808_381932787720028301_n.mp4?_nc_ht=instagram.fyxd3-1.fna.fbcdn.net&_nc_cat=108&_nc_ohc=Vr8RgFEMA7IAX_j1AMW&edm=AP_V10EBAAAA&ccb=7-5&oh=00_AfDiKverzbFtpVHLBwnCr6NGS0PN5MaGrwc7agq5S1FgaA&oe=653671CA&_nc_sid=2999b8"
[download] Sleeping 13.00 seconds ...
[download] Destination: Post by sweetcatworldd - Video 2 [@NA] [CyeOWE-pl7s] [CyeOSIWp8CP].mp4 
[download] 100% of    1.39MiB in 00:00:00 at 2.67MiB/s
[EmbedSubtitle] There aren't any subtitles to embed
[Metadata] Adding metadata to "Post by sweetcatworldd - Video 2 [@NA] [CyeOWE-pl7s] [CyeOSIWp8CP].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Post by sweetcatworldd - Video 2 [@NA] [CyeOWE-pl7s] [CyeOSIWp8CP].mp4" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Post by sweetcatworldd - Video 2" -metadata "purl=https://www.instagram.com/p/CyeOWE-pl7s/" -metadata "comment=https://www.instagram.com/p/CyeOWE-pl7s/" -metadata "artist=NA" -metadata "date=NA" -movflags "+faststart" "file:Post by sweetcatworldd - Video 2 [@NA] [CyeOWE-pl7s] [CyeOSIWp8CP].temp.mp4"
[EmbedThumbnail] mutagen: Adding thumbnail to "Post by sweetcatworldd - Video 2 [@NA] [CyeOWE-pl7s] [CyeOSIWp8CP].mp4" 
[debug] Adding to archive: instagram CyeOSIWp8CP 
[info] Writing updated playlist metadata as JSON to: Post by sweetcatworldd [@NA] [CyeOWE-pl7s].info.json
[download] Finished downloading playlist: Post by sweetcatworldd
```