[sexcom] support new-style '/videos' URLs (#7239)
This commit is contained in:
@@ -58,7 +58,9 @@ class SexcomExtractor(Extractor):
|
||||
|
||||
if "/pin/" in response.url:
|
||||
return self._parse_pin_legacy(response)
|
||||
return self._parse_pin_new(response)
|
||||
if "/videos/" in response.url:
|
||||
return self._parse_pin_video(response)
|
||||
return self._parse_pin_gifs(response)
|
||||
|
||||
def _parse_pin_legacy(self, response):
|
||||
extr = text.extract_from(response.text)
|
||||
@@ -109,8 +111,9 @@ class SexcomExtractor(Extractor):
|
||||
|
||||
return data
|
||||
|
||||
def _parse_pin_new(self, response):
|
||||
def _parse_pin_gifs(self, response):
|
||||
extr = text.extract_from(response.text)
|
||||
|
||||
data = {
|
||||
"_http_headers": {"Referer": response.url},
|
||||
"type": "gif",
|
||||
@@ -123,12 +126,34 @@ class SexcomExtractor(Extractor):
|
||||
|
||||
return text.nameext_from_url(data["url"], data)
|
||||
|
||||
def _parse_pin_video(self, response):
|
||||
extr = text.extract_from(response.text)
|
||||
|
||||
if not self.cookies.get("CloudFront-Key-Pair-Id", domain=".sex.com"):
|
||||
self.log.warning("CloudFront cookies required for video downloads")
|
||||
|
||||
data = {
|
||||
"_ytdl_manifest": "hls",
|
||||
"extension": "mp4",
|
||||
"type": "video",
|
||||
"title": text.unescape(extr("<title>", " | Sex.com<")),
|
||||
"pin_id": text.parse_int(extr(
|
||||
'rel="canonical" href="', '"').rpartition("/")[2]),
|
||||
"tags": text.split_html(extr(
|
||||
'event_name="video_tags_click"', "<div data-testid=")
|
||||
.partition(">")[2]),
|
||||
"url": "ytdl:" + extr('<source src="', '"'),
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class SexcomPinExtractor(SexcomExtractor):
|
||||
"""Extractor for a pinned image or video on www.sex.com"""
|
||||
subcategory = "pin"
|
||||
directory_fmt = ("{category}",)
|
||||
pattern = BASE_PATTERN + r"(/(?:pin|\w\w/gifs)/\d+/?)(?!.*#related$)"
|
||||
pattern = (BASE_PATTERN +
|
||||
r"(/(?:pin|\w\w/(?:gif|video)s)/\d+/?)(?!.*#related$)")
|
||||
example = "https://www.sex.com/pin/12345-TITLE/"
|
||||
|
||||
def pins(self):
|
||||
|
||||
@@ -78,11 +78,64 @@ __tests__ = (
|
||||
|
||||
{
|
||||
"#url" : "https://www.sex.com/pin/55748341/",
|
||||
"#comment" : "video",
|
||||
"#comment" : "video legacy URL",
|
||||
"#category": ("", "sexcom", "pin"),
|
||||
"#class" : sexcom.SexcomPinExtractor,
|
||||
"#urls" : "https://video1.sx.cdn.live/videos/pinporn/2018/02/10/776229_hd.mp4",
|
||||
"#sha1_content": "e1a5834869163e2c4d1ca2677f5b7b367cf8cfff",
|
||||
|
||||
"comments" : range(0, 5),
|
||||
"date" : "2018-02-10 14:58:55",
|
||||
"extension": "mp4",
|
||||
"filename" : "776229_hd",
|
||||
"likes" : range(30, 50),
|
||||
"pin_id" : 55748341,
|
||||
"repins" : range(10, 20),
|
||||
"thumbnail": "https://imagex1.sx.cdn.live/images/pinporn/2018/02/10/19082009.jpg?width=300",
|
||||
"title" : "Pin #55748341",
|
||||
"type" : "video",
|
||||
"uploader" : "Vinsein",
|
||||
"url" : "https://video1.sx.cdn.live/videos/pinporn/2018/02/10/776229_hd.mp4",
|
||||
"tags": [
|
||||
"Hentai",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.sex.com/en/videos/680933",
|
||||
"#comment" : "video",
|
||||
"#category": ("", "sexcom", "pin"),
|
||||
"#class" : sexcom.SexcomPinExtractor,
|
||||
"#urls" : "ytdl:https://videos.sex.com/680933/video.m3u8",
|
||||
|
||||
"extension": "mp4",
|
||||
"pin_id" : 680933,
|
||||
"title" : "Underwater Big Boobs Kristy with Small Boobs Petra",
|
||||
"type" : "video",
|
||||
"url" : "ytdl:https://videos.sex.com/680933/video.m3u8",
|
||||
"tags" : [
|
||||
"#Babe",
|
||||
"#Beach",
|
||||
"#Big Boobs",
|
||||
"#Bikini",
|
||||
"#Brunette",
|
||||
"#Brunette Babe",
|
||||
"#Girlfriend",
|
||||
"#Natural Tits",
|
||||
"#Nude",
|
||||
"#Pool",
|
||||
"#Poolside",
|
||||
"#Public Sex",
|
||||
"#Russian",
|
||||
"#Shower",
|
||||
"#Small Boobs",
|
||||
"#Swimming",
|
||||
"#Swimming Pool",
|
||||
"#Tight Pussy",
|
||||
"#Underwater",
|
||||
"#With",
|
||||
"#Young",
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user