From fb106c20916d9b143b272b5641ef481110021b48 Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Wed, 23 Jan 2019 16:10:54 -0400 Subject: [PATCH 1/5] Fixed extractor and added duration Fixed video_url added duration to info dict --- youtube_dl/extractor/yourporn.py | 14 +++++++++++++- youtube_dl/extractor/yourporn.pyc | Bin 0 -> 2314 bytes 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 youtube_dl/extractor/yourporn.pyc diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index c8dc29bd8..b37561602 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -27,17 +27,29 @@ class YourPornIE(InfoExtractor): self._search_regex( r'data-vnfo=(["\'])(?P{.+?})\1', webpage, 'data info', group='data'), - video_id)[video_id]).replace('/cdn/', '/cdn3/') + video_id)[video_id]).replace('/cdn/', '/cdn4/') title = (self._search_regex( r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title', default=None) or self._og_search_description(webpage)).strip() + if '#' in title: + title = title[0:title.index('#')].strip() thumbnail = self._og_search_thumbnail(webpage) + durationraw = self._search_regex(r'Video Info -> duration:([0-9:]+)', + webpage, 'duration') + if len(durationraw.split(":")) == 3: + duration = int((durationraw.split(":")[0])) * 3600 + \ + int((durationraw.split(":")[1])) * 60 + int((durationraw.split(":")[2])) + elif len(durationraw.split(":")) == 2: + duration = int((durationraw.split(":")[0])) * 60 + int((durationraw.split(":")[1])) + else: + duration = int((durationraw.split(":")[1])) return { 'id': video_id, 'url': video_url, 'title': title, + 'duration': duration, 'thumbnail': thumbnail, 'age_limit': 18 } diff --git a/youtube_dl/extractor/yourporn.pyc b/youtube_dl/extractor/yourporn.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3312898dd7303eeeef0049c0997b13081440440b GIT binary patch literal 2314 zcmcIl-A)@v6h6Ca455%Xgd|0YTADT7zfKne+c^>(9yYqu;-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k)pkw+X`)~;;jyjNM zLNS)Ue!&vgzYW@6DucFuMf8dj_nwo?VX&#?mK3~xMNhz8PhUGhkr#K8E3(9LboR!NB`V8 zPA?K!Fht)xeewL6^SbduXTo{4x&5kf7eePT{>OnfxR6|rlshAji27ci`+haIRb+-U zf7{4m0)HELBE@6rMZI1WHn{t>*O~HzR5z(s{=d1do1oUuU!AR|>`lQe7zOKZx0we+ literal 0 HcmV?d00001 From 92a8be2ebf1dccc8d54782d3e5f433755d17adfe Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Wed, 23 Jan 2019 16:44:51 -0400 Subject: [PATCH 2/5] Added test --- youtube_dl/extractor/yourporn.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index b37561602..f2ac24152 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -6,7 +6,7 @@ from ..utils import urljoin class YourPornIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?yourporn\.sexy/post/(?P[^/?#&.]+)' - _TEST = { + _TESTS = [{ 'url': 'https://yourporn.sexy/post/57ffcb2e1179b.html', 'md5': '6f8682b6464033d87acaa7a8ff0c092e', 'info_dict': { @@ -16,7 +16,19 @@ class YourPornIE(InfoExtractor): 'thumbnail': r're:^https?://.*\.jpg$', 'age_limit': 18 }, - } + }, { + 'url': 'https://yourporn.sexy/post/5c2d2fde03bc5.html', + 'md5': '3b2323fb429d3f559a11b3f22f4754af', + 'info_dict': { + 'id': '5c2d2fde03bc5', + 'ext': 'mp4', + 'title': 'Busty 7 - Nubile Films (2018) - Chanel Preston, ' + + 'Crystal Swift, Jennifer Amton, Shay Evan', + 'thumbnail': r're:^https?://.*\.jpg$', + 'age_limit': 18, + 'duration': 5403 + } + }] def _real_extract(self, url): video_id = self._match_id(url) From c428c3897189336f4ac6e1b6f4762cf9dd5e710e Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Wed, 23 Jan 2019 16:54:08 -0400 Subject: [PATCH 3/5] Validated with flake8 --- youtube_dl/extractor/yourporn.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index f2ac24152..466124d6e 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -23,7 +23,7 @@ class YourPornIE(InfoExtractor): 'id': '5c2d2fde03bc5', 'ext': 'mp4', 'title': 'Busty 7 - Nubile Films (2018) - Chanel Preston, ' - + 'Crystal Swift, Jennifer Amton, Shay Evan', + 'Crystal Swift, Jennifer Amton, Shay Evan', 'thumbnail': r're:^https?://.*\.jpg$', 'age_limit': 18, 'duration': 5403 @@ -47,15 +47,17 @@ class YourPornIE(InfoExtractor): if '#' in title: title = title[0:title.index('#')].strip() thumbnail = self._og_search_thumbnail(webpage) - durationraw = self._search_regex(r'Video Info -> duration:([0-9:]+)', - webpage, 'duration') - if len(durationraw.split(":")) == 3: - duration = int((durationraw.split(":")[0])) * 3600 + \ - int((durationraw.split(":")[1])) * 60 + int((durationraw.split(":")[2])) - elif len(durationraw.split(":")) == 2: - duration = int((durationraw.split(":")[0])) * 60 + int((durationraw.split(":")[1])) + duration_raw = self._search_regex(r'Video Info -> duration:([0-9:]+)', + webpage, 'duration') + if len(duration_raw.split(":")) == 3: + duration = int((duration_raw.split(":")[0])) * 3600 + \ + int((duration_raw.split(":")[1])) * 60 + \ + int((duration_raw.split(":")[2])) + elif len(duration_raw.split(":")) == 2: + duration = int((duration_raw.split(":")[0])) * 60 + \ + int((duration_raw.split(":")[1])) else: - duration = int((durationraw.split(":")[1])) + duration = int((duration_raw.split(":")[1])) return { 'id': video_id, From 944439c15057804c2b512981590a7f268df62309 Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Wed, 23 Jan 2019 16:55:41 -0400 Subject: [PATCH 4/5] Delete yourporn.pyc --- youtube_dl/extractor/yourporn.pyc | Bin 2314 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 youtube_dl/extractor/yourporn.pyc diff --git a/youtube_dl/extractor/yourporn.pyc b/youtube_dl/extractor/yourporn.pyc deleted file mode 100644 index 3312898dd7303eeeef0049c0997b13081440440b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2314 zcmcIl-A)@v6h6Ca455%Xgd|0YTADT7zfKne+c^>(9yYqu;-8dUW=&aDPK4r9S`= z_%|pZ>KU|SkRePG76m5tEZVVv=SYlDkfYuR?Ti4=leDO9kQk+(iB5^$?&L{~(RT3) z)cJqmQ#1gn0*);7y+}wW@Rdy5AoZEjCr<);9=4;+BbB(GiW1)((neV{3A&LVs&T+? zqbzwDCE@eUVGubyf6GC<1|W%jM<_cc`4$I+Fl@vD?`?mCBY@vFT!y2zxI$ta*JmUq za7~i9it8HLh*uOis+}A)wu{%S}qqis)vV%&C=Y)2Y3|2qh=|UM<2>@ zlqyhP)_hUl-79b0|GM<<@mw}P5QgkP;v<38O1tf~mgM4MWxZAEs9un9Z4h}ji`#Cm z*=tKJd&OQ^SY8%u71wj!io4csFL(>SD`XUs!c3VtF+i0i*I&AhVl*5?S3F=AiVbS?b374>B&d z>SVoE==y;_1x!D=`&{mxuQcYP!jAAg<*`dF!r$+>aDSi|j)}TB4LUXG#MG$4=&?zs zCY@NM@CX!amOjyqKv5^%rYP^JW%QYG&OoL+s5Z;z1~Q{sW{kM>Xj;pNf6*lU4%^)^ z?&K55j??i79powbjREus&aQ44uzfY;3;Vu<+tR-02bLzZrAgSJlTlKTAEoXDw;1H{ zk3KsvDf!V*lNU&^G{fWqO<$&5?^C8|`u1hg4NbazGDhLSr;Odu#(w>jF#&xrcv)lL znASM+4@6k=5icq*P4+P=auXMFh0!`jiYIYlBizDF-6rul+1te#)O;(uhf}!9oqvy} zcv9TG*L?VHj)#UH>pztqZ=B3E7j@h4%PjYf;!fO8qAbpGXX3g!%bp0!SsqUet(3Dz z0BgH@^>>e(EiZ7>^oiF05`(!ZeD&(7rqzqPdo`ZSVS_8)HA1%CEKnJ5r~5t*${yl) z;|m$h@{*dJug{7sag`s1)mjT`7UtKhP*f|o>e(202UM-2iY0^rEL_FGI{g|SJOLk1 zCeQi54N(y)NHLewbCuU|e4%(RIU+g?gUA)mp=`yNxdv-TyMYwDNh+Og8ign>@Km}9 zBon!h9l+rxG7el%D$eLu6iRiA*`oacr;w?a_%R2o^PeilIAwk)pkw+X`)~;;jyjNM zLNS)Ue!&vgzYW@6DucFuMf8dj_nwo?VX&#?mK3~xMNhz8PhUGhkr#K8E3(9LboR!NB`V8 zPA?K!Fht)xeewL6^SbduXTo{4x&5kf7eePT{>OnfxR6|rlshAji27ci`+haIRb+-U zf7{4m0)HELBE@6rMZI1WHn{t>*O~HzR5z(s{=d1do1oUuU!AR|>`lQe7zOKZx0we+ From 57bd5660511e186b186addf82c50c5bf8e459a8d Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Wed, 23 Jan 2019 17:58:05 -0400 Subject: [PATCH 5/5] separated duration parse to new function --- youtube_dl/extractor/yourporn.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index 466124d6e..a32c32b95 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -30,6 +30,15 @@ class YourPornIE(InfoExtractor): } }] + def _parse_duration(self, s): + duration = 0 + size = len(s.split(":")) + j = size - 1 + for i in range(size): + duration += int(s.split(":")[i]) * (60 ** j) + j = j - 1 + return duration + def _real_extract(self, url): video_id = self._match_id(url) @@ -47,18 +56,8 @@ class YourPornIE(InfoExtractor): if '#' in title: title = title[0:title.index('#')].strip() thumbnail = self._og_search_thumbnail(webpage) - duration_raw = self._search_regex(r'Video Info -> duration:([0-9:]+)', - webpage, 'duration') - if len(duration_raw.split(":")) == 3: - duration = int((duration_raw.split(":")[0])) * 3600 + \ - int((duration_raw.split(":")[1])) * 60 + \ - int((duration_raw.split(":")[2])) - elif len(duration_raw.split(":")) == 2: - duration = int((duration_raw.split(":")[0])) * 60 + \ - int((duration_raw.split(":")[1])) - else: - duration = int((duration_raw.split(":")[1])) - + duration = self._parse_duration(self._search_regex(r'Video Info -> duration:([0-9:]+)', + webpage, 'duration')) return { 'id': video_id, 'url': video_url,