soimort/you-get · error · Exception
Cannot find flashvars
Error message
Cannot find flashvars
What it means
Raised as plain Exception in ICousesExactor.get_flashvars (src/you_get/extractors/icourses.py:209). The video page must contain a 'var flashvars = {...};' JS block that supplies IService, uuid, other and the player version needed to build API URLs; if the regex finds no such block, extraction cannot proceed.
Source
Thrown at src/you_get/extractors/icourses.py:209
return
def get_title(self):
if 'viewVCourse' in self.url:
self.title = public_course_get_title(self.url, self.page)
return
title_a_patt = r'<div class="con"> <a.*?>(.*?)</a>'
title_b_patt = r'<div class="con"> <a.*?/a>((.|\n)*?)</div>'
title_a = match1(self.page, title_a_patt).strip()
title_b = match1(self.page, title_b_patt).strip()
title = title_a + title_b
title = re.sub('( +|\n|\t|\r| )', '', unescape_html(title).replace(' ', ''))
self.title = title
def get_flashvars(self):
patt = r'var flashvars\s*=\s*(\{(?:.|\n)+?\});'
hit = re.search(patt, self.page)
if hit is None:
raise Exception('Cannot find flashvars')
flashvar_str = hit.group(1)
uuid = re.search(r'uuid\s*:\s*\"?(\w+)\"?', flashvar_str).group(1)
other = re.search(r'other\s*:\s*"(.*?)"', flashvar_str).group(1)
isvc = re.search(r'IService\s*:\s*\'(.+?)\'', flashvar_str).group(1)
player_time_patt = r'MPlayer.swf\?v\=(\d+)'
player_time = re.search(player_time_patt, self.page).group(1)
self.flashvars = dict(IService=isvc, uuid=uuid, other=other, v=player_time)
def api_req(self, url):
xml_str = get_content(url)
dom = parseString(xml_str)
status = dom.getElementsByTagName('result')[0].getAttribute('status')
if status != 'success':
raise Exception('API returned fail')
View on GitHub (pinned to 049548f3f3)
Solutions
- Fetch the page manually (curl with the same fake_headers) and verify the flashvars block exists in the served HTML.
- If the block is gone or reformatted, update the regex and the downstream uuid/IService/other extraction in get_flashvars for the new template.
- Ensure the URL is an actual video resource page (changeforVideo.action / showResDetail.action), not a course listing.
Defensive patterns
Strategy: try-catch
Validate before calling
import re
def page_has_flashvars(html):
return re.search(r'var flashvars\s*=\s*(\{(?:.|\n)+?\});', html) is not None Try / catch
try:
icourses_download(url, output_dir)
except Exception as e:
if str(e) == 'Cannot find flashvars':
# likely bot-wall or redesign: fetch page manually and inspect
log_page_for_triage(url)
else:
raise Prevention
- Check the served HTML actually contains the flashvars block before extraction.
- Treat this error as a site-change signal — retrying the same request rarely helps.
When it happens
Trigger: basic_extract() runs get_flashvars() on a page whose HTML lacks r'var flashvars\s*=\s*(\{(?:.|\n)+?\});'. Causes: icourses changed its player/page template, removed the inline flashvars, or get_content returned an error/interstitial page instead of the video page.
Common situations: Site redesign replacing the flash player markup; anti-bot page or login wall returned instead of real content; URL pointing to a non-video resource page that never had flashvars.
Related errors
- API returned fail
- Unsupported url
- 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/659b2949c4e50382.
Report an issue: GitHub.