]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/pr0gramm.py
3 from .common
import InfoExtractor
4 from ..utils
import merge_dicts
7 class Pr0grammStaticIE(InfoExtractor
):
9 # https://pr0gramm.com/static/5466437
10 _VALID_URL
= r
'https?://pr0gramm\.com/static/(?P<id>[0-9]+)'
12 'url': 'https://pr0gramm.com/static/5466437',
13 'md5': '52fa540d70d3edc286846f8ca85938aa',
17 'title': 'pr0gramm-5466437 by g11st',
19 'upload_date': '20221221',
23 def _real_extract(self
, url
):
24 video_id
= self
._match
_id
(url
)
25 webpage
= self
._download
_webpage
(url
, video_id
)
28 entries
= self
._parse
_html
5_media
_entries
(url
, webpage
, video_id
)
29 media_info
= entries
[0]
32 uploader
= self
._html
_search
_regex
(r
'by\W+([\w-]+)\W+', webpage
, 'uploader')
34 # Fetch approx upload timestamp from filename
35 # Have None-defaults in case the extraction fails
40 # (//img.pr0gramm.com/2022/12/21/62ae8aa5e2da0ebf.mp4)
41 m
= re
.search(r
'//img\.pr0gramm\.com/(?P<year>[\d]+)/(?P<mon>[\d]+)/(?P<day>[\d]+)/\w+\.\w{,4}', webpage
)
44 # Up to a day of accuracy should suffice...
45 uploadDay
= m
.groupdict().get('day')
46 uploadMon
= m
.groupdict().get('mon')
47 uploadYear
= m
.groupdict().get('year')
48 uploadTimestr
= uploadYear
+ uploadMon
+ uploadDay
52 'title': 'pr0gramm-%s%s' % (video_id
, (' by ' + uploader
) if uploader
else ''),
54 'upload_date': uploadTimestr
58 # This extractor is for the primary url (used for sharing, and appears in the
59 # location bar) Since this page loads the DOM via JS, yt-dl can't find any
60 # video information here. So let's redirect to a compatibility version of
61 # the site, which does contain the <video>-element by itself, without requiring
63 class Pr0grammIE(InfoExtractor
):
65 # https://pr0gramm.com/new/546637
66 # https://pr0gramm.com/new/video/546637
67 # https://pr0gramm.com/top/546637
68 # https://pr0gramm.com/top/video/546637
69 # https://pr0gramm.com/user/g11st/uploads/5466437
70 # https://pr0gramm.com/user/froschler/dafur-ist-man-hier/5091290
71 # https://pr0gramm.com/user/froschler/reinziehen-1elf/5232030
72 # https://pr0gramm.com/user/froschler/1elf/5232030
73 # https://pr0gramm.com/new/5495710:comment62621020 <- this is not the id!
74 # https://pr0gramm.com/top/fruher war alles damals/5498175
76 _VALID_URL
= r
'https?:\/\/pr0gramm\.com\/(?!static/\d+).+?\/(?P<id>[\d]+)(:|$)'
78 'url': 'https://pr0gramm.com/new/video/5466437',
82 'title': 'pr0gramm-5466437 by g11st',
84 'upload_date': '20221221',
91 def _real_extract(self
, url
):
92 video_id
= self
._match
_id
(url
)
94 return self
.url_result(
95 'https://pr0gramm.com/static/' + video_id
,
97 ie
=Pr0grammStaticIE
.ie_key())