3 from .common
import InfoExtractor
4 from ..utils
import determine_ext
, int_or_none
7 class ScrolllerIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?scrolller\.com/(?P<id>[\w-]+)'
10 'url': 'https://scrolller.com/a-helping-hand-1k9pxikxkw',
12 'id': 'a-helping-hand-1k9pxikxkw',
14 'thumbnail': 'https://zepto.scrolller.com/a-helping-hand-3ty9q8x094-540x960.jpg',
15 'title': 'A helping hand',
19 'url': 'https://scrolller.com/tigers-chasing-a-drone-c5d1f2so6j',
21 'id': 'tigers-chasing-a-drone-c5d1f2so6j',
23 'thumbnail': 'https://zepto.scrolller.com/tigers-chasing-a-drone-az9pkpguwe-540x303.jpg',
24 'title': 'Tigers chasing a drone',
28 'url': 'https://scrolller.com/baby-rhino-smells-something-9chhugsv9p',
30 'id': 'baby-rhino-smells-something-9chhugsv9p',
32 'thumbnail': 'https://atto.scrolller.com/hmm-whats-that-smell-bh54mf2c52-300x224.jpg',
33 'title': 'Baby rhino smells something',
37 'url': 'https://scrolller.com/its-all-fun-and-games-cco8jjmoh7',
39 'id': 'its-all-fun-and-games-cco8jjmoh7',
41 'thumbnail': 'https://atto.scrolller.com/its-all-fun-and-games-3amk9vg7m3-540x649.jpg',
42 'title': 'It\'s all fun and games...',
46 'url': 'https://scrolller.com/may-the-force-be-with-you-octokuro-yeytg1fs7a',
48 'id': 'may-the-force-be-with-you-octokuro-yeytg1fs7a',
50 'thumbnail': 'https://thumbs2.redgifs.com/DarkStarchyNautilus-poster.jpg',
51 'title': 'May the force be with you (Octokuro)',
56 def _real_extract(self
, url
):
57 video_id
= self
._match
_id
(url
)
61 getSubredditPost(url:"/%s"){
71 }''' % video_id
, # noqa: UP031
74 video_data
= self
._download
_json
(
75 'https://api.scrolller.com/api/v2/graphql', video_id
, data
=json
.dumps(query
).encode(),
76 headers
={'Content-Type': 'application/json'})['data']['getSubredditPost']
78 formats
, thumbnails
= [], []
79 for source
in video_data
['mediaSources']:
80 if determine_ext(source
.get('url')) in ('jpg', 'png'):
83 'width': int_or_none(source
.get('width')),
84 'height': int_or_none(source
.get('height')),
86 elif source
.get('url'):
89 'width': int_or_none(source
.get('width')),
90 'height': int_or_none(source
.get('height')),
94 self
.raise_no_formats('There is no video.', expected
=True, video_id
=video_id
)
98 'title': video_data
.get('title'),
99 'thumbnails': thumbnails
,
101 'age_limit': 18 if video_data
.get('isNsfw') else 0,