1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00

Changed to handle mobile site URLs and some others.

This commit is contained in:
florty2 2025-03-18 11:48:34 +11:00
parent 3e9ee8d150
commit 3cbeff725f

View File

@ -1,5 +1,6 @@
import random import random
import re import re
import socket
import urllib.parse import urllib.parse
from .common import InfoExtractor from .common import InfoExtractor
@ -8,7 +9,7 @@
class MyFreeCamsIE(InfoExtractor): class MyFreeCamsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?myfreecams\.com/#(?P<id>[^/?&#]+)' _VALID_URL = r'https?:\/\/(?:\w+\.)?myfreecams\.com\/(?:(?:models\/|chats\/)?\#?(?P<id>\w+))'
_TESTS = [{ _TESTS = [{
'url': 'https://www.myfreecams.com/#Elise_wood', 'url': 'https://www.myfreecams.com/#Elise_wood',
'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
@ -25,6 +26,22 @@ class MyFreeCamsIE(InfoExtractor):
'skip_download': True, 'skip_download': True,
}, },
'skip': 'Model is currently offline', 'skip': 'Model is currently offline',
}, {
'url': 'https://m.myfreecams.com/chats/Elise_wood',
'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
'info_dict': {
'id': 'Elise_wood',
'ext': 'mp4',
'title': r're:.*MyFreeCams.*',
'age_limit': 0,
'is_live': True,
'live_status': str,
},
'params': {
'skip_download': True,
},
'skip': 'Model is currently offline',
}] }]
JS_SERVER_URL = 'https://www.myfreecams.com/_js/serverconfig.js' JS_SERVER_URL = 'https://www.myfreecams.com/_js/serverconfig.js'
@ -51,7 +68,7 @@ def _websocket_data(self, username, chat_servers):
self.write_debug(f'Websocket server {xchat} connected') self.write_debug(f'Websocket server {xchat} connected')
self.write_debug(f'Websocket URL: {host}') self.write_debug(f'Websocket URL: {host}')
break break
except websockets.exceptions.WebSocketException: except (websockets.exceptions.WebSocketException, socket.gaierror):
self.report_warning(f'Failed to connect to WS server: {xchat} - try {try_to_connect + 1}') self.report_warning(f'Failed to connect to WS server: {xchat} - try {try_to_connect + 1}')
if try_to_connect == 4: if try_to_connect == 4:
error = f'Failed to connect to WS server: {host}' error = f'Failed to connect to WS server: {host}'