Repository: yt-dlp/yt-dlp

Issue:
"Unable to extract OpenGraph title" when trying to download from fc2
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.01.21**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [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

Russia

### Description

I get "Unable to extract OpenGraph title" error whenever I try to download video from fc2

### Verbose log

```shell
D:\youtube-dl>yt-dlp.exe -vU --cookies=cookies.txt -f "bestvideo[fps>=59][height=720][ext=mp4]+bestaudio[ext=m4a]/bestvideo[fps>=59][height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[height<=720]/best[height<=1080]" --no-playlist -a ytdlp-links.txt
[debug] Command-line config: ['-vU', '--cookies=cookies.txt', '-f', 'bestvideo[fps>=59][height=720][ext=mp4]+bestaudio[ext=m4a]/bestvideo[fps>=59][height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[height<=720]/best[height<=1080]', '--no-playlist', '-a', 'ytdlp-links.txt']
[debug] Batch file urls: ['https://video.fc2.com/content/201110052Z4kmmNX']
[debug] Encodings: locale cp1251, fs utf-8, out utf-8, err utf-8, pref cp1251
[debug] yt-dlp version 2022.01.21 [f20d607] (win_exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-10-10.0.19042-SP0
[debug] exe versions: ffmpeg 4.2.3, ffprobe 2021-05-26-git-7a879cce37-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2022.01.21, Current version: 2022.01.21
yt-dlp is up to date (2022.01.21)
[debug] [fc2] Extracting URL: https://video.fc2.com/content/201110052Z4kmmNX
[fc2] 201110052Z4kmmNX: Downloading webpage
ERROR: [fc2] 201110052Z4kmmNX: Unable to extract OpenGraph title; please report this issue on  https://github.com/yt-dlp/yt-dlp . Make sure you are using the latest version; type  yt-dlp -U  to update. Be sure to call yt-dlp with the --verbose flag and include its complete output.; please report this issue on  https://github.com/yt-dlp/yt-dlp . Make sure you are using the latest version; type  yt-dlp -U  to update. Be sure to call yt-dlp with the --verbose flag and include its complete output.
  File "yt_dlp\extractor\common.py", line 612, in extract
  File "yt_dlp\extractor\fc2.py", line 88, in _real_extract
  File "yt_dlp\extractor\common.py", line 1294, in _og_search_title
  File "yt_dlp\extractor\common.py", line 1282, in _og_search_property
  File "yt_dlp\extractor\common.py", line 1186, in _search_regex
```



Discussion:
cc @Lesmiscore since u were working on fc2 live
@pukkandan These two has diff structure, not like YT.
Anyway I see something has to be fixed

Resolving patch:
diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py
--- a/yt_dlp/extractor/fc2.py
+++ b/yt_dlp/extractor/fc2.py
@@ -1,18 +1,16 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
-import hashlib
-
 from .common import InfoExtractor
 from ..compat import (
     compat_parse_qs,
-    compat_urllib_request,
-    compat_urlparse,
 )
 from ..utils import (
     ExtractorError,
     sanitized_Request,
+    traverse_obj,
     urlencode_postdata,
+    urljoin,
 )
 
 
@@ -82,41 +80,32 @@ def _real_extract(self, url):
             self._downloader.cookiejar.clear_session_cookies()  # must clear
             self._login()
 
-        title = 'FC2 video %s' % video_id
-        thumbnail = None
+        title, thumbnail, description = None, None, None
         if webpage is not None:
-            title = self._og_search_title(webpage)
+            title = self._html_search_regex(
+                (r'<h2\s+class="videoCnt_title">([^<]+?)</h2>',
+                 r'\s+href="[^"]+"\s*title="([^"]+?)"\s*rel="nofollow">\s*<img',
+                 # there's two matches in the webpage
+                 r'\s+href="[^"]+"\s*title="([^"]+?)"\s*rel="nofollow">\s*\1'),
+                webpage,
+                'title', fatal=False)
             thumbnail = self._og_search_thumbnail(webpage)
-        refer = url.replace('/content/', '/a/content/') if '/a/content/' not in url else url
-
-        mimi = hashlib.md5((video_id + '_gGddgPfeaf_gzyr').encode('utf-8')).hexdigest()
-
-        info_url = (
-            'http://video.fc2.com/ginfo.php?mimi={1:s}&href={2:s}&v={0:s}&fversion=WIN%2011%2C6%2C602%2C180&from=2&otag=0&upid={0:s}&tk=null&'.
-            format(video_id, mimi, compat_urllib_request.quote(refer, safe=b'').replace('.', '%2E')))
-
-        info_webpage = self._download_webpage(
-            info_url, video_id, note='Downloading info page')
-        info = compat_urlparse.parse_qs(info_webpage)
+            description = self._og_search_description(webpage)
 
-        if 'err_code' in info:
-            # most of the time we can still download wideo even if err_code is 403 or 602
-            self.report_warning(
-                'Error code was: %s... but still trying' % info['err_code'][0])
-
-        if 'filepath' not in info:
-            raise ExtractorError('Cannot download file. Are you logged in?')
-
-        video_url = info['filepath'][0] + '?mid=' + info['mid'][0]
-        title_info = info.get('title')
-        if title_info:
-            title = title_info[0]
+        vidplaylist = self._download_json(
+            'https://video.fc2.com/api/v3/videoplaylist/%s?sh=1&fs=0' % video_id, video_id,
+            note='Downloading info page')
+        vid_url = traverse_obj(vidplaylist, ('playlist', 'nq'))
+        if not vid_url:
+            raise ExtractorError('Unable to extract video URL')
+        vid_url = urljoin('https://video.fc2.com/', vid_url)
 
         return {
             'id': video_id,
             'title': title,
-            'url': video_url,
-            'ext': 'flv',
+            'url': vid_url,
+            'ext': 'mp4',
+            'description': description,
             'thumbnail': thumbnail,
         }
 


Test patch: