Compare commits

..

2 Commits

Author SHA1 Message Date
bashonly
d4d4c1a3a5
cosmetic 2024-01-19 02:45:07 +00:00
bashonly
24e15d8f03
Apply suggestions from code review 2024-01-19 02:43:03 +00:00
2 changed files with 17 additions and 9 deletions

View File

@ -787,7 +787,7 @@ from .iheart import (
IHeartRadioIE,
IHeartRadioPodcastIE,
)
from .ilpost import IlPostExtractorIE
from .ilpost import IlPostIE
from .iltalehti import IltalehtiIE
from .imdb import (
ImdbIE,

View File

@ -1,12 +1,18 @@
import functools
from .common import InfoExtractor
from ..utils import ExtractorError, float_or_none, int_or_none, url_or_none, urlencode_postdata
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class IlPostExtractorIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ilpost\.it/episodes/(?P<id>[^/?]+).*'
class IlPostIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ilpost\.it/episodes/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.ilpost.it/episodes/1-avis-akvasas-ka/',
'md5': '43649f002d85e1c2f319bb478d479c40',
@ -26,27 +32,29 @@ class IlPostExtractorIE(InfoExtractor):
}]
def _real_extract(self, url):
podcast_display_id = self._match_id(url)
webpage = self._download_webpage(url, podcast_display_id)
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
endpoint_metadata = self._search_json(
r'var\s+ilpostpodcast\s*=', webpage, 'metadata', podcast_display_id)
r'var\s+ilpostpodcast\s*=', webpage, 'metadata', display_id)
episode_id = endpoint_metadata['post_id']
podcast_id = endpoint_metadata['podcast_id']
podcast_metadata = self._download_json(
endpoint_metadata['ajax_url'], podcast_display_id, data=urlencode_postdata({
endpoint_metadata['ajax_url'], display_id, data=urlencode_postdata({
'action': 'checkpodcast',
'cookie': endpoint_metadata['cookie'],
'post_id': episode_id,
'podcast_id': podcast_id,
}))
episode = traverse_obj(podcast_metadata, (
'data', 'postcastList', lambda _, v: str(v['id']) == episode_id, {dict}), get_all=False)
if not episode:
raise ExtractorError('Episode could not be extracted')
return {
'id': episode_id,
'display_id': podcast_display_id,
'display_id': display_id,
'series_id': podcast_id,
'vcodec': 'none',
**traverse_obj(episode, {