def __init__(self, pid, grabber, data): super(Elem, self).__init__() self.pid = pid self.title = data.findtext("titolo") self.description = data.findtext("descrizione") self.channel = data.findtext("dominio") self.grabber = grabber strTime = data.findtext("datapubblicazione") strTime = strTime.replace("-", "/") self.datetime = datetime.datetime.strptime(strTime, "%d/%m/%Y") # extra experimental data h264 = data.findtext("h264") Utils.addH264Url(self.h264, 0, h264) self.ts = data.findtext("m3u8") self.id = data.findtext("localid") self.length = data.findtext("durata") web = data.findtext("web") if not web: web = RAIUrls.getWebFromID(self.id) self.url = RAIUrls.base + web self.filename = Utils.makeFilename(self.title) self.canFollow = True
def handle_starttag(self, tag, attrs): if tag == "meta": val = self.extract(attrs, "videourl") if val: self.values.videoUrl = val val = self.extract(attrs, "videourl_mp4") if val: self.values.videoUrlMP4 = val val = self.extract(attrs, "videourl_h264") if val: self.values.videoUrlH264 = val val = self.extract(attrs, "videourl_m3u8") if val: self.values.videoUrlM3U8 = val val = self.extract(attrs, "title") if val: self.values.title = val val = self.extract(attrs, "programmaTV") if val: self.values.program = val val = self.extract(attrs, "description") if val: self.values.description = val val = self.extract(attrs, "tipo") if val: self.values.type = val val = self.extract(attrs, "itemDate") if val: self.values.date = val val = self.extract(attrs, "idPageProgramma") if val: self.values.page = RAIUrls.base + RAIUrls.getWebFromID(val) elif tag == "param": if len(attrs) > 0: if attrs[0][0] == "value": path = attrs[0][1] if path.find("videoPath") == 0: firstEqual = path.find("=") firstComma = path.find(",") self.values.videoPath = path[firstEqual + 1: firstComma]
def handle_starttag(self, tag, attrs): if tag == "meta": val = self.extract(attrs, "videourl") if val: self.values.videoUrl = val val = self.extract(attrs, "videourl_mp4") if val: self.values.videoUrlMP4 = val val = self.extract(attrs, "videourl_h264") if val: self.values.videoUrlH264 = val val = self.extract(attrs, "videourl_m3u8") if val: self.values.videoUrlM3U8 = val val = self.extract(attrs, "title") if val: self.values.title = val val = self.extract(attrs, "programmaTV") if val: self.values.program = val val = self.extract(attrs, "description") if val: self.values.description = val val = self.extract(attrs, "tipo") if val: self.values.type = val val = self.extract(attrs, "itemDate") if val: self.values.date = val val = self.extract(attrs, "idPageProgramma") if val: self.values.page = RAIUrls.base + RAIUrls.getWebFromID(val) elif tag == "param": if len(attrs) > 0: if attrs[0][0] == "value": path = attrs[0][1] if path.find("videoPath") == 0: firstEqual = path.find("=") firstComma = path.find(",") self.values.videoPath = path[firstEqual + 1:firstComma]