[ie/omnyfm] updated extractor to use _search_nextjs_data for json data parsing

This commit is contained in:
subrat-lima 2024-09-19 14:01:03 +05:30
parent 3e4523b78c
commit 549d28cd04

View File

@ -1,12 +1,10 @@
import functools import functools
import json
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
OnDemandPagedList, OnDemandPagedList,
clean_html, clean_html,
float_or_none, float_or_none,
get_element_by_id,
int_or_none, int_or_none,
str_or_none, str_or_none,
traverse_obj, traverse_obj,
@ -56,7 +54,7 @@ def _real_extract(self, url):
page_url = 'https://omny.fm/shows/' + display_id page_url = 'https://omny.fm/shows/' + display_id
webpage = self._download_webpage(page_url, display_id) webpage = self._download_webpage(page_url, display_id)
data = json.loads(get_element_by_id('__NEXT_DATA__', webpage)) data = self._search_nextjs_data(webpage, display_id)
org_id = traverse_obj(data, ('props', 'pageProps', 'program', 'OrganizationId', {str_or_none})) org_id = traverse_obj(data, ('props', 'pageProps', 'program', 'OrganizationId', {str_or_none}))
playlist_id = traverse_obj(data, ('props', 'pageProps', 'program', 'Id', {str_or_none})) playlist_id = traverse_obj(data, ('props', 'pageProps', 'program', 'Id', {str_or_none}))
title = traverse_obj(data, ('props', 'pageProps', 'program', 'Name', {str_or_none})) title = traverse_obj(data, ('props', 'pageProps', 'program', 'Name', {str_or_none}))