ggogel / SocialMediaDownloadMaubot

7 stars 2 forks source link

Feature: Configure Title Language for YouTube and YouTube Music #9

Open Mikaela opened 9 months ago

Mikaela commented 9 months ago

For example when I link https://music.youtube.com/watch?v=E0Vpx47tDlc the bot reports the title as 暗躍のダークスーツ (FFVII『タークスのテーマ』より) while in YouTube Music Android app it's Dark Suits (from FFVII 'Turks' Theme'.

I don't know what the bot is doing wrong, but I guess it might be not sending accept-language header or something? This can also be reproduced with the YouTube Music Android app when using language Finnish, but changing the app language to English (Finland) changes all the titles to English.

ggogel commented 8 months ago

Hi, thanks for the issue report.

Even with Accept-Language = en-US the title remains in the original language:

https://www.youtube.com/oembed?format=json&url=https://music.youtube.com/watch?v=E0Vpx47tDlc

{
  "title": "暗躍のダークスーツ (FFVII『タークスのテーマ』より)",
  "author_name": "Nobuo Uematsu - Topic",
  "author_url": "https://www.youtube.com/channel/UCZOd9KDD58MZR13UbbtdrpQ",
  "type": "video",
  "height": 150,
  "width": 200,
  "version": "1.0",
  "provider_name": "YouTube",
  "provider_url": "https://www.youtube.com/",
  "thumbnail_height": 360,
  "thumbnail_width": 480,
  "thumbnail_url": "https://i.ytimg.com/vi/E0Vpx47tDlc/hqdefault.jpg",
  "html": "<iframe width=\"200\" height=\"150\" src=\"https://www.youtube.com/embed/E0Vpx47tDlc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen title=\"暗躍のダークスーツ (FFVII『タークスのテーマ』より)\"></iframe>"
}

Given that this is an unusual edge case and more of a new feature for specifying the title language rather than a bug, I won't be investigating further myself. However, I welcome any pull requests addressing this matter.