- videoid = re.findall("/video/(.*)[/]*",argv[1])[0]
- soup = BeautifulSoup(urllib2.urlopen("http://www.svtplay.se/video/%s/?type=embed"%videoid).read())
- flashvars = json.loads(soup.find("param", {"name":"flashvars",'value':True})['value'][5:])
- except(IndexError):
- page = urllib2.urlopen(argv[1]).read()
- videoid = re.findall("svt_article_id=(.*)[&]*",page)[0]
- flashvars = json.loads(urllib2.urlopen("http://www.svt.se/wd?widgetId=248134§ionId=1024&articleId=%s&position=0&format=json&type=embed&contextSectionId=1024"%videoid).read())
- try:
- title = flashvars['statistics']['title']