2024-02-19 20:47:49 +00:00
import re
2022-02-15 11:10:16 +00:00
from . common import InfoExtractor
from . . utils import (
2024-02-19 20:47:49 +00:00
urlencode_postdata ,
extract_attributes
2022-02-15 11:10:16 +00:00
)
class MurrtubeIE ( InfoExtractor ) :
_VALID_URL = r ''' (?x)
( ? :
murrtube : |
2024-02-19 20:47:49 +00:00
https ? : / / murrtube \. net / v / |
https ? : / / murrtube \. net / videos / ( ? P < slug > [ a - z0 - 9 \- ] + ? ) \-
2022-02-15 11:10:16 +00:00
)
2024-02-19 20:47:49 +00:00
( ? P < id > [ A - Z0 - 9 ] { 4 } | [ a - f0 - 9 ] { 8 } \- [ a - f0 - 9 ] { 4 } \- [ a - f0 - 9 ] { 4 } \- [ a - f0 - 9 ] { 4 } \- [ a - f0 - 9 ] { 12 } )
2022-02-15 11:10:16 +00:00
'''
2024-02-19 20:47:49 +00:00
_TESTS = [
{
" url " : " https://murrtube.net/videos/inferno-x-skyler-148b6f2a-fdcc-4902-affe-9c0f41aaaca0 " ,
2024-02-19 21:17:26 +00:00
" md5 " : " 70380878a77e8565d4aea7f68b8bbb35 " ,
2024-02-19 20:47:49 +00:00
" info_dict " : {
" id " : " ca885d8456b95de529b6723b158032e11115d " ,
" ext " : " mp4 " ,
" title " : " Inferno X Skyler " ,
" description " : " Humping a very good slutty sheppy (roomate) " ,
" uploader " : " Inferno Wolf " ,
" age_limit " : 18 ,
2024-02-19 21:17:26 +00:00
" thumbnail " : " https://storage.murrtube.net/murrtube-production/ekbs3zcfvuynnqfx72nn2tkokvsd "
2022-02-15 11:10:16 +00:00
} ,
2024-02-19 20:47:49 +00:00
} ,
{
" url " : " https://murrtube.net/v/0J2Q " ,
2024-02-19 21:17:26 +00:00
" md5 " : " 31262f6ac56f0ca75e5a54a0f3fefcb6 " ,
2024-02-19 20:47:49 +00:00
" info_dict " : {
" id " : " 8442998c52134968d9caa36e473e1a6bac6ca " ,
2024-02-19 21:17:26 +00:00
" ext " : " mp4 " ,
2024-02-19 20:47:49 +00:00
" uploader " : " Hayel " ,
2024-02-19 21:17:26 +00:00
" title " : " Who ' s in charge now? " ,
" description " : """ Fenny sneaked into my bed room and played naughty with one of my plushies. I caught him in the act and wanted to punish him. He thought he was in charge and wanted to use me instead but he wasn ' t prepared on my butt milking him within just a minute. Fenny: @fenny_ad (both here and on Twitter) Hayel on Twitter: https://twitter.com/plushmods """ ,
2024-02-19 20:47:49 +00:00
" age_limit " : 18 ,
2024-02-19 21:17:26 +00:00
" thumbnail " : " https://storage.murrtube.net/murrtube-production/fb1ojjwiucufp34ya6hxu5vfqi5s "
2024-02-19 20:47:49 +00:00
}
}
]
2022-02-15 11:10:16 +00:00
2024-02-19 20:47:49 +00:00
def _real_extract ( self , url ) :
video_id = self . _match_valid_url ( url )
# TODO: This part could be smarter (Set and store age cookie?)
video_page = self . _download_webpage (
' https://murrtube.net ' , None , note = ' Getting session token ' )
data = self . _hidden_inputs ( video_page )
self . _download_webpage (
' https://murrtube.net/accept_age_check ' , None , ' Set age cookie ' , data = urlencode_postdata ( data ) )
video_page = self . _download_webpage ( url , None )
video_attrs = extract_attributes ( self . _search_regex ( r ' (<video[^>]+>) ' , video_page , ' video ' ) )
playlist = video_attrs [ ' data-url ' ] . split ( ' ? ' ) [ 0 ]
matches = re . compile ( r ' https://storage.murrtube.net/murrtube-production/.+/(?P<id>.+)/index.m3u8 ' ) . match ( playlist ) . groupdict ( )
video_id = matches [ ' id ' ]
formats = self . _extract_m3u8_formats ( playlist , video_id , ' mp4 ' , entry_protocol = ' m3u8_native ' , fatal = False )
title = self . _html_search_meta (
' og:title ' , video_page , display_name = ' title ' , fatal = True ) [ : - 11 ]
description = self . _html_search_meta (
' og:description ' , video_page , display_name = ' description ' , fatal = True )
thumbnail = self . _html_search_meta (
2024-02-19 21:17:26 +00:00
' og:image ' , video_page , display_name = ' thumbnail ' , fatal = True ) . split ( " ? " ) [ 0 ]
2024-02-19 20:47:49 +00:00
uploader = self . _html_search_regex (
r ' <span class= " pl-1 is-size-6 has-text-lighter " >(.+?)</span> ' , video_page , ' uploader ' , default = None )
2022-02-15 11:10:16 +00:00
return {
' id ' : video_id ,
2024-02-19 20:47:49 +00:00
' title ' : title ,
' age_limit ' : 18 ,
2022-02-15 11:10:16 +00:00
' formats ' : formats ,
2024-02-19 20:47:49 +00:00
' description ' : description ,
2022-02-15 11:10:16 +00:00
' thumbnail ' : thumbnail ,
2024-02-19 20:47:49 +00:00
' uploader ' : uploader ,
2022-02-15 11:10:16 +00:00
}