mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-09 12:32:56 +08:00
added pornjam.py to add pornjam
pornjam.py added,added import to generic.py, added import to extractors.py
This commit is contained in:
parent
8b347a389e
commit
c471981763
@ -1280,6 +1280,7 @@ from .yahoo import (
|
||||
YahooIE,
|
||||
YahooSearchIE,
|
||||
)
|
||||
from .yam import YamIE
|
||||
from .yandexmusic import (
|
||||
YandexMusicTrackIE,
|
||||
YandexMusicAlbumIE,
|
||||
@ -1319,3 +1320,4 @@ from .zapiks import ZapiksIE
|
||||
from .zaq1 import Zaq1IE
|
||||
from .zdf import ZDFIE, ZDFChannelIE
|
||||
from .zingmp3 import ZingMp3IE
|
||||
from .pornjam import PornjamIE
|
@ -91,6 +91,7 @@ from .anvato import AnvatoIE
|
||||
from .washingtonpost import WashingtonPostIE
|
||||
from .wistia import WistiaIE
|
||||
from .mediaset import MediasetIE
|
||||
from .pornjam import PornjamIE
|
||||
|
||||
|
||||
class GenericIE(InfoExtractor):
|
||||
|
82
youtube_dl/extractor/pornjam.py
Normal file
82
youtube_dl/extractor/pornjam.py
Normal file
@ -0,0 +1,82 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..compat import compat_urllib_parse_unquote
|
||||
from ..utils import (
|
||||
clean_html,
|
||||
determine_ext,
|
||||
ExtractorError,
|
||||
int_or_none,
|
||||
parse_duration,
|
||||
)
|
||||
|
||||
|
||||
class PornjamIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?pornjam\.com/video(?P<id>[0-9]+)(?:.*)'
|
||||
_TEST = {
|
||||
'url': 'https://www.pornjam.com/video/rocking-the-room-and-bed/',
|
||||
'md5': '',
|
||||
'info_dict': {
|
||||
'id': '86331',
|
||||
'ext': 'mp4',
|
||||
'title': 'Rocking the room and bed',
|
||||
'duration': 1548, # 25:48
|
||||
'age_limit': 18,
|
||||
#direct source :https://cdnlw5.videosgratis.tv/videos/8/5/4/4/0/85440ea8900376934eab3692672df0f0e11e35a1.mp4?key=z1pkypF6pH6-z8SLEh-1AiTK2zOD8TXPZeK3ffJM8L4AyPoJ3gvGsi7xmJlK5SPi4JkoI1ooZzrBCKBfpmNRScDz92dA7HATYETMYRtKNxqqq9ERzxVGz_srVrrvPGiV04qCNDwqQ212YWRU1v2DfQMUF-T3piVCb0UuWmknO0GT6-zBlE2EzRfuVWY2-JEho0iBbikj1rbWgBXe71o53g7NhRGlZHDu-l_AZ_MFs0k
|
||||
}
|
||||
}
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
mobj = re.search(r'<h1 class="inlineError">(.+?)</h1>', webpage)
|
||||
if mobj:
|
||||
raise ExtractorError('%s said: %s' % (self.IE_NAME, clean_html(mobj.group(1))), expected=True)
|
||||
|
||||
video_title = self._html_search_regex(
|
||||
r'<title>(.*?)\s+-\s+- Pornjam.com', webpage, 'title')
|
||||
video_thumbnail = self._search_regex(
|
||||
r'url_bigthumb=(.+?)&', webpage, 'thumbnail', fatal=False)
|
||||
video_duration = int_or_none(self._og_search_property(
|
||||
'duration', webpage, default=None)) or parse_duration(
|
||||
self._search_regex(
|
||||
r'<span[^>]+class=["\']duration["\'][^>]*>.*?(\d[^<]+)',
|
||||
webpage, 'duration', fatal=False))
|
||||
|
||||
formats = []
|
||||
|
||||
video_url = compat_urllib_parse_unquote(self._search_regex(
|
||||
r'flv_url=(.+?)&', webpage, 'video URL', default=''))
|
||||
if video_url:
|
||||
formats.append({
|
||||
'url': video_url,
|
||||
'format_id': 'flv',
|
||||
})
|
||||
|
||||
for kind, _, format_url in re.findall(
|
||||
r'setVideo([^(]+)\((["\'])(http.+?)\2\)', webpage):
|
||||
format_id = kind.lower()
|
||||
if format_id == 'hls':
|
||||
formats.extend(self._extract_m3u8_formats(
|
||||
format_url, video_id, 'mp4',
|
||||
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))
|
||||
elif format_id in ('urllow', 'urlhigh'):
|
||||
formats.append({
|
||||
'url': format_url,
|
||||
'format_id': '%s-%s' % (determine_ext(format_url, 'mp4'), format_id[3:]),
|
||||
'quality': -2 if format_id.endswith('low') else None,
|
||||
})
|
||||
|
||||
self._sort_formats(formats)
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'formats': formats,
|
||||
'title': video_title,
|
||||
'duration': video_duration,
|
||||
'thumbnail': video_thumbnail,
|
||||
'age_limit': 18,
|
||||
}
|
Loading…
Reference in New Issue
Block a user