##// END OF EJS Templates
Download HTML only as a link, not as a file
neko259 -
r1683:0b52d251 default
parent child Browse files
Show More
@@ -19,6 +19,11 b' FILE_DOWNLOAD_CHUNK_BYTES = 200000'
19
19
20 YOUTUBE_URL = re.compile(r'https?://((www\.)?youtube\.com/watch\?v=|youtu.be/)[-\w]+')
20 YOUTUBE_URL = re.compile(r'https?://((www\.)?youtube\.com/watch\?v=|youtu.be/)[-\w]+')
21
21
22 TYPE_URL_ONLY = (
23 'application/xhtml+xml',
24 'text/html',
25 )
26
22
27
23 class Downloader:
28 class Downloader:
24 @staticmethod
29 @staticmethod
@@ -77,3 +82,14 b' class YouTubeDownloader(Downloader):'
77 def handles(url: str) -> bool:
82 def handles(url: str) -> bool:
78 return YOUTUBE_URL.match(url)
83 return YOUTUBE_URL.match(url)
79
84
85
86 class NothingDownloader(Downloader):
87 @staticmethod
88 def handles(url: str) -> bool:
89 response_head = requests.head(url, verify=False)
90 content_type = response_head.headers[HEADER_CONTENT_TYPE].split(';')[0]
91 return content_type in TYPE_URL_ONLY
92
93 @staticmethod
94 def download(url: str):
95 return None
General Comments 0
You need to be logged in to leave comments. Login now