Created
August 10, 2026 13:53
-
-
Save SalimF/5ca02c67693cde1164cd48736107dc3a to your computer and use it in GitHub Desktop.
yourupload_fix.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from urllib.parse import urljoin | |
| from yt_dlp.extractor.common import InfoExtractor | |
| from yt_dlp.utils import determine_ext | |
| class YourUploadRevivedIE(InfoExtractor): | |
| IE_NAME = 'yourupload:revived' | |
| _VALID_URL = r'https?://(?:www\.)?(?:yourupload\.com/(?:watch|embed)|embed\.yourupload\.com)/(?P<id>[A-Za-z0-9]+)' | |
| _TESTS = [{ | |
| 'url': 'https://www.yourupload.com/embed/5ReRhH1JrQvG', | |
| 'only_matching': True, | |
| }] | |
| def _real_extract(self, url): | |
| video_id = self._match_id(url) | |
| embed_url = f'https://www.yourupload.com/embed/{video_id}' | |
| webpage = self._download_webpage( | |
| embed_url, video_id, | |
| headers={'Referer': 'https://www.yourupload.com/'} | |
| ) | |
| title = ( | |
| self._html_search_meta(['og:title', 'twitter:title'], webpage, default=None) | |
| or self._search_regex( | |
| [r'<title>([^<]+)</title>', | |
| r'''(?i)\btitle\s*:\s*["']([^"']+)'''], | |
| webpage, 'title', default=video_id) | |
| ) | |
| thumbnail = self._html_search_meta( | |
| ['og:image', 'twitter:image'], webpage, default=None) | |
| video_url = ( | |
| self._html_search_meta( | |
| ['og:video:url', 'og:video', 'twitter:player:stream'], | |
| webpage, default=None) | |
| or self._search_regex( | |
| [ | |
| r'''<source[^>]+src=["']([^"'?]+\.(?:mp4|m3u8)(?:\?[^"']*)?)["']''', | |
| r'''(?i)\bfile\s*:\s*["']([^"']+)["']''', | |
| r'''(?i)\bsrc\s*:\s*["']([^"']+\.(?:mp4|m3u8)(?:\?[^"']*)?)["']''', | |
| r'''(?i)\bvideo_url\s*[:=]\s*["']([^"']+)["']''', | |
| ], | |
| webpage, 'video url') | |
| ) | |
| video_url = urljoin(embed_url, video_url) | |
| thumbnail = urljoin(embed_url, thumbnail) if thumbnail else None | |
| ext = determine_ext(video_url, None) | |
| if ext == 'm3u8': | |
| formats = self._extract_m3u8_formats( | |
| video_url, video_id, 'mp4', fatal=False, | |
| headers={'Referer': embed_url} | |
| ) | |
| for f in formats: | |
| f.setdefault('http_headers', {})['Referer'] = embed_url | |
| return { | |
| 'id': video_id, | |
| 'title': title, | |
| 'thumbnail': thumbnail, | |
| 'formats': formats, | |
| 'http_headers': {'Referer': embed_url}, | |
| } | |
| return { | |
| 'id': video_id, | |
| 'title': title, | |
| 'url': video_url, | |
| 'thumbnail': thumbnail, | |
| 'http_headers': {'Referer': embed_url}, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment