soimort/you-get · error · Exception
Unknown url pattern
Error message
Unknown url pattern
What it means
Raised as plain Exception in icourses_playlist_download (src/you_get/extractors/icourses.py:113). After routing the URL through its known branches (course listing pages with pagination, viewCharacterDetail.action, changeforVideo.action), none of them produced any (resId, courseId) video entries — video_list is empty — so the URL layout is unrecognized.
Source
Thrown at src/you_get/extractors/icourses.py:113
playlist = public_course_playlist(url)
for video in playlist:
icourses_download(video[0], output_dir=output_dir, **kwargs)
return
elif 'coursestatic' in url:
course_page = get_content(url)
page_navi_vars = re.search(page_type_patt, course_page)
if page_navi_vars is None: # type 2 shared course
video_list = icourses_playlist_new(url, course_page)
else: # type 1 shared course
sec_page = get_content(ep.format(page_navi_vars.group(2), page_navi_vars.group(1)))
video_list = re.findall(resid_courseid_patt, sec_page)
elif 'viewCharacterDetail.action' in url or 'changeforVideo.action' in url:
page = get_content(url)
video_list = re.findall(resid_courseid_patt, page)
if not video_list:
raise Exception('Unknown url pattern')
for video in video_list:
video_url = change_for_video_ip.format(video[0], video[1])
sleep(random.Random().randint(0, 5)) # Prevent from blockage
icourses_download(video_url, output_dir=output_dir, **kwargs)
def icourses_playlist_new(url, page=None):
# 2 helpers using same interface in the js code
def to_chap(course_id, chap_id, mod):
ep = 'http://www.icourses.cn/jpk/viewCharacterDetail2.action?courseId={}&characId={}&mod={}'
req = post_content(ep.format(course_id, chap_id, mod), post_data={})
return req
def to_sec(course_id, chap_id, mod):
ep = 'http://www.icourses.cn/jpk/viewCharacterDetail2.action?courseId={}&characId={}&mod={}'
req = post_content(ep.format(course_id, chap_id, mod), post_data={})
return reqView on GitHub (pinned to 049548f3f3)
Solutions
- Confirm the URL is one of the three known icourses page kinds and opens correctly in a browser.
- Log course_page and check whether resid_courseid_patt still matches the HTML; if not, update the regexes for the new markup.
- Upgrade you-get — icourses extractors are maintained against the live site.
Defensive patterns
Strategy: try-catch
Validate before calling
KNOWN_MARKERS = ('coursestatic', 'viewCharacterDetail.action', 'changeforVideo.action', 'showResDetail.action')
def icourses_url_plausibly_supported(url):
return any(m in url for m in KNOWN_MARKERS) or re.match(
r'http://www\.icourses\.cn/coursestatic/course_\d+\.html', url) is not None Try / catch
try:
icourses_playlist_download(url, output_dir)
except Exception as e:
if str(e) == 'Unknown url pattern':
flag_extractor_stale(url) # markup changed; needs human/regex update
else:
raise Prevention
- Only pass icourses URLs of the three known page kinds.
- When this fires on valid URLs, dump the fetched HTML and re-check the regexes rather than retrying.
When it happens
Trigger: Passing an icourses.cn URL whose path contains none of the known markers ('coursestatic'/'course_' listing, 'viewCharacterDetail.action', 'changeforVideo.action'), OR one of those pages whose HTML changed so re.findall(resid_courseid_patt, ...) returns nothing and the pagination regex also fails to match (page_navi_vars None AND the type-2 fallback yields no videos).
Common situations: icourses.cn site redesign breaking the regexes; new course page types; URLs with parameters/redirects landing on an unexpected page.
Related errors
- You can download it with -l flag
- No video found in this playlist
- Playlist is not supported for
- Flickr extractor is not supported for %s.
- Cannot find flashvars
AI-assisted analysis of soimort/you-get@049548f3f3 (2026-08-15).
Data as JSON: /api/errors/5d82662e52d4a745.
Report an issue: GitHub.