soimort/you-get · error · Exception
Failed
Error message
Failed
What it means
Raised as plain Exception in icourses_download (src/you_get/extractors/icourses.py:39). The code tries up to 5 times to probe the generated video URL with url_info() to learn the file size; if every attempt raises urllib's HTTPError (logged as 'Failed to fetch the video file! Retrying...'), size stays None and the download is aborted.
Source
Thrown at src/you_get/extractors/icourses.py:39
raise Exception('You can download it with -l flag')
icourses_parser = ICousesExactor(url=url)
icourses_parser.basic_extract()
title = icourses_parser.title
size = None
for i in range(5):
try:
# use this url only for size
size_url = icourses_parser.generate_url(0)
_, type_, size = url_info(size_url, headers=fake_headers)
except error.HTTPError:
logging.warning('Failed to fetch the video file! Retrying...')
sleep(random.Random().randint(2, 5)) # Prevent from blockage
else:
print_info(site_info, title, type_, size)
break
if size is None:
raise Exception("Failed")
if not kwargs['info_only']:
real_url = icourses_parser.update_url(0)
headers = fake_headers.copy()
headers['Referer'] = url
download_urls_icourses(real_url, title, 'flv',total_size=size, output_dir=output_dir, max_size=15728640, dyn_callback=icourses_parser.update_url)
return
def get_course_title(url, course_type, page=None):
if page is None:
try:
# shard course page could be gbk but with charset="utf-8"
page = get_content(url, decoded=False).decode('gbk')
except UnicodeDecodeError:
page = get_content(url, decoded=False).decode('utf8')
if course_type == 'shared_old':View on GitHub (pinned to 049548f3f3)
Solutions
- Wait several minutes and retry — the failure mode is usually temporary blocking.
- Verify the generated size_url in a browser/curl; a persistent 4xx means the URL construction (flashvars parsing) is broken — upgrade you-get or fix ICousesExactor.
- Reduce request frequency in scripts (honor the existing randomized sleeps) to avoid tripping the block.
Defensive patterns
Strategy: retry
Try / catch
import time
for attempt in range(3):
try:
icourses_download(url, output_dir)
break
except Exception as e:
if str(e) == 'Failed':
time.sleep(300) # let the server-side block cool down
continue
raise Prevention
- Space icourses requests minutes apart; the extractor already random-sleeps to dodge blocks.
- Failures after the built-in 5 retries mean a hard block or dead URL — stop, don't hammer.
When it happens
Trigger: ICousesExactor.generate_url(0) yields a URL that url_info() rejects with HTTPError on 5 consecutive attempts: the icourses server blocks/throttles the request (the code sleeps 2-5s between tries specifically to 'prevent blockage'), or the generated URL is invalid (bad uuid/IService flashvars) so the server answers 4xx/5xx every time.
Common situations: Aggressive repeated downloads getting rate-limited/blocked by icourses.cn; expired or wrongly parsed player tokens producing dead URLs; site-side changes to the video API.
Related errors
- Server refused to provide download link! (Errno:%s)
- Share not found or canceled: %s
- You can download it with -l flag
- Unknown url pattern
- No video found in this playlist
AI-assisted analysis of soimort/you-get@049548f3f3 (2026-08-15).
Data as JSON: /api/errors/76d00d887923e27b.
Report an issue: GitHub.