+ return cmd('emph')(self, element)
+
+ def handle_obraz(self, element):
+ frmt = self.options['format']
+ name = element.attrib.get('nazwa', '').strip()
+ image = frmt.get_image(name.strip())
+ img_path = "obraz/%s" % name.replace("_", "")
+ frmt.attachments[img_path] = image
+ return cmd("obraz", parms=[img_path])(self)
+
+ def handle_video(self, element):
+ url = element.attrib.get('url')
+ if not url:
+ print '!! <video> missing url'
+ return
+ m = re.match(r'(?:https?://)?(?:www.)?youtube.com/watch\?(?:.*&)?v=([^&]+)(?:$|&)', url)
+ if not m:
+ print '!! unknown <video> url scheme:', url
+ return
+ name = m.group(1)
+ thumb = IOFile.from_string(urlopen
+ ("http://img.youtube.com/vi/%s/0.jpg" % name).read())
+ img_path = "video/%s.jpg" % name.replace("_", "")
+ self.options['format'].attachments[img_path] = thumb
+ canon_url = "https://www.youtube.com/watch?v=%s" % name
+ return cmd("video", parms=[img_path, canon_url])(self)