Compare commits

...

3 Commits

Author SHA1 Message Date
Lem
18051a07e9
Merge 3aa60c8861 into da252d9d32 2024-11-18 09:35:59 +05:30
lem
3aa60c8861 Fix order of new extractor 2023-10-04 22:47:53 +02:00
lem
9f3feaa9a5 [Pietsmiet] Add extractor 2023-10-04 22:41:05 +02:00
2 changed files with 58 additions and 0 deletions

View File

@ -1526,6 +1526,7 @@ from .picarto import (
PicartoIE,
PicartoVodIE,
)
from .pietsmiet import PietsmietIE
from .piksel import PikselIE
from .pinkbike import PinkbikeIE
from .pinterest import (

View File

@ -0,0 +1,57 @@
from .common import InfoExtractor
from ..utils import (
traverse_obj,
)
import base64
class PietsmietIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pietsmiet\.de/videos/(?P<id>\d+)-.*'
_TESTS = [{
'url': 'https://www.pietsmiet.de/videos/77307-brammen-erzahlt-vom-leben-als-geschaftsfuhrer',
'md5': '9bca7b377a34bfe4d7a437dd499ff46b',
'info_dict': {
'id': '77307',
'ext': 'mp4',
'title': 'Brammen erzählt vom Leben als Geschäftsführer',
'thumbnail': 'https://www.pietsmiet.de/storage/media/71/90/03/7161edccc3e3a9f6f78b6d8b637edc2d.jpg'
}
}]
# Pietsmiet.de uses base64 to hide a value needed to make API call
def _extract_integrity(self, vid):
integrity = self._search_json('window._i = ', self._web,
name='Extracting Origin Integrity',
video_id=vid,
fatal=True)
integrity = base64.b64decode(integrity['v']).decode("ascii")
return integrity
def _real_extract(self, url):
video_id = self._match_id(url)
self._web = self._download_webpage(url, video_id, note='Caching webpage')
origin_integrity = self._extract_integrity(video_id)
data_json = self._download_json(
f'https://www.pietsmiet.de/api/v1/utility/player?video={video_id}&preset=quality',
video_id=video_id,
headers={'x-origin-integrity': origin_integrity})
title = traverse_obj(data_json, ('options', 'tracks', 0, 'full_title'))
aspect_ratio = traverse_obj(data_json, ('options', 'visual', 'aspect_ratio'))
thumbnail = traverse_obj(data_json, ('options', 'visual', 'thumbnail'))
m3u8_url = traverse_obj(data_json, ('options', 'tracks', 0, 'sources', 'hls', 'src'))
formats = self._extract_m3u8_formats(m3u8_url, video_id)
return {
'id': video_id,
'title': title,
'formats': formats,
'aspect_ratio': aspect_ratio,
'thumbnail': thumbnail,
}