mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-22 10:21:24 +02:00
Compare commits
No commits in common. "ce7f2057c0f7c0743b7eac7bc535dc73b37d11e5" and "04f21c56035f5709477f3ba18e571481448ab286" have entirely different histories.
ce7f2057c0
...
04f21c5603
|
@ -1,4 +1,7 @@
|
||||||
|
import re
|
||||||
import math
|
import math
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
@ -6,7 +9,6 @@ from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
unified_strdate
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +26,7 @@ class ZenPornIE(InfoExtractor):
|
||||||
'title': 'md5:669eafd3bbc688aa29770553b738ada2',
|
'title': 'md5:669eafd3bbc688aa29770553b738ada2',
|
||||||
'description': '',
|
'description': '',
|
||||||
'thumbnail': 'md5:2fc044a19bab450fef8f1931e7920a18',
|
'thumbnail': 'md5:2fc044a19bab450fef8f1931e7920a18',
|
||||||
'post_date': '20230925',
|
'post_date': '2023-09-25 18:28:11',
|
||||||
'uploader': 'md5:9fae59847f1f58d1da8f2772016c12f3',
|
'uploader': 'md5:9fae59847f1f58d1da8f2772016c12f3',
|
||||||
'age_limit': 18
|
'age_limit': 18
|
||||||
}
|
}
|
||||||
|
@ -39,7 +41,7 @@ class ZenPornIE(InfoExtractor):
|
||||||
'title': 'md5:47aebdf87644ec91e8b1a844bc832451',
|
'title': 'md5:47aebdf87644ec91e8b1a844bc832451',
|
||||||
'description': '',
|
'description': '',
|
||||||
'thumbnail': 'https://tn.manysex.com/contents/videos_screenshots/2297000/2297875/480x270/1.jpg',
|
'thumbnail': 'https://tn.manysex.com/contents/videos_screenshots/2297000/2297875/480x270/1.jpg',
|
||||||
'post_date': '20230921',
|
'post_date': '2023-09-21 04:42:51',
|
||||||
'uploader': 'Lois Clarke',
|
'uploader': 'Lois Clarke',
|
||||||
'age_limit': 18
|
'age_limit': 18
|
||||||
}
|
}
|
||||||
|
@ -54,7 +56,7 @@ class ZenPornIE(InfoExtractor):
|
||||||
'title': 'Amateur students having a fuck fest at club',
|
'title': 'Amateur students having a fuck fest at club',
|
||||||
'description': '',
|
'description': '',
|
||||||
'thumbnail': 'https://tn.txxx.tube/contents/videos_screenshots/12791000/12791908/288x162/1.jpg',
|
'thumbnail': 'https://tn.txxx.tube/contents/videos_screenshots/12791000/12791908/288x162/1.jpg',
|
||||||
'post_date': '20191005',
|
'post_date': '2019-10-05 12:12:34',
|
||||||
'uploader': 'Jackopenass',
|
'uploader': 'Jackopenass',
|
||||||
'age_limit': 18
|
'age_limit': 18
|
||||||
}
|
}
|
||||||
|
@ -69,24 +71,33 @@ class ZenPornIE(InfoExtractor):
|
||||||
'title': 'Glad You Came',
|
'title': 'Glad You Came',
|
||||||
'description': '',
|
'description': '',
|
||||||
'thumbnail': 'https://vpim.m3pd.com/contents/videos_screenshots/111000/111585/480x270/1.jpg',
|
'thumbnail': 'https://vpim.m3pd.com/contents/videos_screenshots/111000/111585/480x270/1.jpg',
|
||||||
'post_date': '20231024',
|
'post_date': '2023-10-24 15:50:03',
|
||||||
'uploader': 'Martin Rudenko',
|
'uploader': 'Martin Rudenko',
|
||||||
'age_limit': 18
|
'age_limit': 18
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
def _gen_info_url(self, ext_domain, extr_id, lifetime=86400):
|
def _extract_embed_info(self, source):
|
||||||
""" This function is a reverse engineering from the website javascript """
|
embed = namedtuple('embed', ['ext_domain', 'extr_id'])
|
||||||
dyn_a = int_or_none(1e6 * math.floor(int_or_none(extr_id) / 1e6))
|
regex = re.compile(
|
||||||
dyn_b = int_or_none(1e3 * math.floor(int_or_none(extr_id) / 1e3))
|
r'https:\/\/(?P<ext_domain>[\w.-]+\.\w{3})\/embed\/(?P<extr_id>\d+)\/')
|
||||||
|
match = regex.search(source)
|
||||||
|
|
||||||
|
if match:
|
||||||
|
return embed(match.group('ext_domain'), match.group('extr_id'))
|
||||||
|
else:
|
||||||
|
return embed(None, None)
|
||||||
|
|
||||||
|
def _gen_info_url(self, embed, lifetime=86400):
|
||||||
|
dyn_a = int_or_none(1e6 * math.floor(int_or_none(embed.extr_id) / 1e6))
|
||||||
|
dyn_b = int_or_none(1e3 * math.floor(int_or_none(embed.extr_id) / 1e3))
|
||||||
if dyn_a is None or dyn_b is None:
|
if dyn_a is None or dyn_b is None:
|
||||||
raise ExtractorError('Unable to generate the ``gen_info_url``.')
|
raise ExtractorError('Unable to generate the ``gen_info_url``.')
|
||||||
|
|
||||||
return f'https://{ext_domain}/api/json/video/{lifetime}/{dyn_a}/{dyn_b}/{extr_id}.json'
|
return f'https://{embed.ext_domain}/api/json/video/{lifetime}/{dyn_a}/{dyn_b}/{embed.extr_id}.json'
|
||||||
|
|
||||||
def _decode_video_url(self, ext_domain, encoded_url):
|
def _decode_video_url(self, ext_domain, encoded_url):
|
||||||
""" This function is a reverse engineering from the website javascript """
|
|
||||||
cust_char_set = 'АВСDЕFGHIJKLМNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,~'
|
cust_char_set = 'АВСDЕFGHIJKLМNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,~'
|
||||||
decoded_url = ''
|
decoded_url = ''
|
||||||
cur_pos = 0
|
cur_pos = 0
|
||||||
|
@ -123,36 +134,34 @@ class ZenPornIE(InfoExtractor):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
ext_domain, extr_id = self._search_regex(
|
embed = self._extract_embed_info(webpage)
|
||||||
r'https:\/\/(?P<ext_domain>[\w.-]+\.\w{3})\/embed\/(?P<extr_id>\d+)\/',
|
if not embed.ext_domain or not embed.extr_id:
|
||||||
webpage, 'embed_info', group=('ext_domain', 'extr_id'))
|
raise ExtractorError('Unable to retrieve the ``embed`` info.')
|
||||||
|
|
||||||
info_json = self._download_json(self._gen_info_url(ext_domain, extr_id),
|
info_url = self._gen_info_url(embed)
|
||||||
video_id, note="Downloading JSON metadata for the video info.")
|
info_json = self._download_json(
|
||||||
if not info_json:
|
info_url, video_id, note="Downloading JSON metadata for the video info.")
|
||||||
raise ExtractorError('Unable to retrieve the video info.')
|
|
||||||
|
|
||||||
video_json = self._download_json(f'https://{ext_domain}/api/videofile.php?video_id={extr_id}&lifetime=8640000',
|
video_info_url = f'https://{embed.ext_domain}/api/videofile.php?video_id={embed.extr_id}&lifetime=8640000'
|
||||||
video_id, note="Downloading JSON metadata for the video location.")
|
video_json = self._download_json(
|
||||||
if not video_json:
|
video_info_url, video_id, note="Downloading JSON metadata for the video location.")
|
||||||
raise ExtractorError('Unable to retrieve the the video location.')
|
|
||||||
|
|
||||||
encoded_url = video_json[0].get('video_url')
|
encoded_url = video_json[0].get('video_url')
|
||||||
if not encoded_url:
|
if not encoded_url:
|
||||||
raise ExtractorError('Unable to retrieve the `encoded_url` value.')
|
raise ExtractorError('Unable to retrieve the ``encoded_url``.')
|
||||||
|
|
||||||
download_url = self._decode_video_url(ext_domain, encoded_url)
|
download_url = self._decode_video_url(embed.ext_domain, encoded_url)
|
||||||
if not download_url:
|
if not download_url:
|
||||||
raise ExtractorError('Unable to retrieve the ``download_url``.')
|
raise ExtractorError('Unable to retrieve the ``download_url``.')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'extr_id': extr_id,
|
'extr_id': embed.extr_id,
|
||||||
'ext': determine_ext(video_json[0].get('format')),
|
'ext': determine_ext(video_json[0].get('format')),
|
||||||
'title': traverse_obj(info_json, ('video', 'title')),
|
'title': traverse_obj(info_json, ('video', 'title')),
|
||||||
'description': traverse_obj(info_json, ('video', 'description')),
|
'description': traverse_obj(info_json, ('video', 'description')),
|
||||||
'thumbnail': traverse_obj(info_json, ('video', 'thumb')),
|
'thumbnail': traverse_obj(info_json, ('video', 'thumb')),
|
||||||
'post_date': unified_strdate(traverse_obj(info_json, ('video', 'post_date'))),
|
'post_date': traverse_obj(info_json, ('video', 'post_date')),
|
||||||
'uploader': traverse_obj(info_json, ('video', 'user', 'username')),
|
'uploader': traverse_obj(info_json, ('video', 'user', 'username')),
|
||||||
'url': download_url,
|
'url': download_url,
|
||||||
'age_limit': 18
|
'age_limit': 18
|
||||||
|
|
Loading…
Reference in New Issue
Block a user