{"record":{"id":"659b2949c4e50382","repo":"soimort/you-get","slug":"cannot-find-flashvars","errorCode":null,"errorMessage":"Cannot find flashvars","messagePattern":"Cannot find flashvars","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/you_get/extractors/icourses.py","lineNumber":209,"sourceCode":"        return\n\n    def get_title(self):\n        if 'viewVCourse' in self.url:\n            self.title = public_course_get_title(self.url, self.page)\n            return\n        title_a_patt = r'<div class=\"con\"> <a.*?>(.*?)</a>'\n        title_b_patt = r'<div class=\"con\"> <a.*?/a>((.|\\n)*?)</div>'\n        title_a = match1(self.page, title_a_patt).strip()\n        title_b = match1(self.page, title_b_patt).strip()\n        title = title_a + title_b\n        title = re.sub('( +|\\n|\\t|\\r|&nbsp;)', '', unescape_html(title).replace(' ', ''))\n        self.title = title\n\n    def get_flashvars(self):\n        patt = r'var flashvars\\s*=\\s*(\\{(?:.|\\n)+?\\});'\n        hit = re.search(patt, self.page)\n        if hit is None:\n            raise Exception('Cannot find flashvars')\n        flashvar_str = hit.group(1)\n\n        uuid = re.search(r'uuid\\s*:\\s*\\\"?(\\w+)\\\"?', flashvar_str).group(1)\n        other = re.search(r'other\\s*:\\s*\"(.*?)\"', flashvar_str).group(1)\n        isvc = re.search(r'IService\\s*:\\s*\\'(.+?)\\'', flashvar_str).group(1)\n\n        player_time_patt = r'MPlayer.swf\\?v\\=(\\d+)'\n        player_time = re.search(player_time_patt, self.page).group(1)\n\n        self.flashvars = dict(IService=isvc, uuid=uuid, other=other, v=player_time)\n\n    def api_req(self, url):\n        xml_str = get_content(url)\n        dom = parseString(xml_str)\n        status = dom.getElementsByTagName('result')[0].getAttribute('status')\n        if status != 'success':\n            raise Exception('API returned fail')\n","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/soimort/you-get/blob/049548f3f3f35e67ba8d3181c71fdc71d11cf260/src/you_get/extractors/icourses.py#L191-L227","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import re\n\ndef page_has_flashvars(html):\n    return re.search(r'var flashvars\\s*=\\s*(\\{(?:.|\\n)+?\\});', html) is not None","typeGuard":null,"tryCatchPattern":"try:\n    icourses_download(url, output_dir)\nexcept Exception as e:\n    if str(e) == 'Cannot find flashvars':\n        # likely bot-wall or redesign: fetch page manually and inspect\n        log_page_for_triage(url)\n    else:\n        raise","preventionTips":["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."],"tags":["you-get","icourses","parse-error","site-change","extractor"],"backgroundTag":null,"analyzedSha":"049548f3f3f35e67ba8d3181c71fdc71d11cf260","analyzedAt":"2026-08-15T03:58:15.069Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}