]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/yahoo.py
[generic] Extract m3u8 formats from JSON-LD
[yt-dlp.git] / yt_dlp / extractor / yahoo.py
index df1e078acd63fdc02cfec7999e7734a22c2d2cb5..313e596f56e6ff432af40ba8f4c0cc72d9e1b566 100644 (file)
@@ -264,7 +264,7 @@ def _extract_yahoo_video(self, video_id, country):
 
         return {
             'id': video_id,
-            'title': self._live_title(title) if is_live else title,
+            'title': title,
             'formats': formats,
             'thumbnails': thumbnails,
             'description': clean_html(video.get('description')),
@@ -279,7 +279,7 @@ def _extract_yahoo_video(self, video_id, country):
         }
 
     def _real_extract(self, url):
-        url, country, display_id = re.match(self._VALID_URL, url).groups()
+        url, country, display_id = self._match_valid_url(url).groups()
         if not country:
             country = 'us'
         else:
@@ -334,31 +334,15 @@ class YahooSearchIE(SearchInfoExtractor):
     IE_NAME = 'screen.yahoo:search'
     _SEARCH_KEY = 'yvsearch'
 
-    def _get_n_results(self, query, n):
-        """Get a specified number of results for a query"""
-        entries = []
+    def _search_results(self, query):
         for pagenum in itertools.count(0):
             result_url = 'http://video.search.yahoo.com/search/?p=%s&fr=screen&o=js&gs=0&b=%d' % (compat_urllib_parse.quote_plus(query), pagenum * 30)
             info = self._download_json(result_url, query,
                                        note='Downloading results page ' + str(pagenum + 1))
-            m = info['m']
-            results = info['results']
-
-            for (i, r) in enumerate(results):
-                if (pagenum * 30) + i >= n:
-                    break
-                mobj = re.search(r'(?P<url>screen\.yahoo\.com/.*?-\d*?\.html)"', r)
-                e = self.url_result('http://' + mobj.group('url'), 'Yahoo')
-                entries.append(e)
-            if (pagenum * 30 + i >= n) or (m['last'] >= (m['total'] - 1)):
+            yield from (self.url_result(result['rurl']) for result in info['results'])
+            if info['m']['last'] >= info['m']['total'] - 1:
                 break
 
-        return {
-            '_type': 'playlist',
-            'id': query,
-            'entries': entries,
-        }
-
 
 class YahooGyaOPlayerIE(InfoExtractor):
     IE_NAME = 'yahoo:gyao:player'
@@ -527,7 +511,7 @@ def _extract_formats(self, json_data, content_id):
         return formats
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         host = mobj.group('host')
         display_id = mobj.group('id') or host