def _common(self, data): m = {} try: m["mid"] = str(data["id"]) m["service"] = "twitter" m["account"] = self.account["id"] m["time"] = util.parsetime(data["created_at"]) m["text"] = unescape(data["text"]) m["to_me"] = ("@%s" % self.account["username"]) in data["text"] m["html"] = util.linkify( data["text"], ((util.PARSE_HASH, '#<a class="hash" href="%s#search?q=\\1">\\1</a>' % URL_PREFIX), (util.PARSE_NICK, '@<a class="nick" href="%s/\\1">\\1</a>' % URL_PREFIX)), escape=False) m["content"] = util.linkify(data["text"], (( util.PARSE_HASH, '#<a class="hash" href="gwibber:/tag?acct=%s&query=\\1">\\1</a>' % m["account"] ), (util.PARSE_NICK, '@<a class="nick" href="gwibber:/user?acct=%s&name=\\1">\\1</a>' % m["account"])), escape=False) images = util.imgpreview(m["text"]) if images: m["images"] = images except: log.logger.error("%s failure - %s", PROTOCOL_INFO["name"], data) return m
def _common(self, data): m = {} try: m["mid"] = str(data["id"]) m["service"] = "statusnet" m["account"] = self.account["id"] m["time"] = util.parsetime(data["created_at"]) m["source"] = data.get("source", False) m["text"] = data["text"] m["to_me"] = ("@%s" % self.account["username"]) in data["text"] m["html"] = util.linkify(m["text"], ((util.PARSE_HASH, '#<a class="hash" href="%s#search?q=\\1">\\1</a>' % self.url_prefix), (util.PARSE_NICK, '@<a class="nick" href="%s/\\1">\\1</a>' % self.url_prefix))) m["content"] = util.linkify(m["text"], ((util.PARSE_HASH, '#<a class="hash" href="gwibber:/tag?acct=%s&query=\\1">\\1</a>' % m["account"]), (util.PARSE_NICK, '@<a class="nick" href="gwibber:/user?acct=%s&name=\\1">\\1</a>' % m["account"]))) images = [] if data.get("attachments", 0): for a in data["attachments"]: mime = a.get("mimetype", "") if mime and mime.startswith("image") and a.get("url", 0): images.append({"src": a["url"], "url": a["url"]}) images.extend(util.imgpreview(m["text"])) if images: m["images"] = images except: log.logger.error("%s failure - %s", PROTOCOL_INFO["name"], data) return m
def _common(self, data): m = {}; try: m["mid"] = str(data["id"]) m["service"] = "twitter" m["account"] = self.account["id"] m["time"] = util.parsetime(data["created_at"]) m["text"] = unescape(data["text"]) m["to_me"] = ("@%s" % self.account["username"]) in data["text"] m["html"] = util.linkify(data["text"], ((util.PARSE_HASH, '#<a class="hash" href="%s#search?q=\\1">\\1</a>' % URL_PREFIX), (util.PARSE_NICK, '@<a class="nick" href="%s/\\1">\\1</a>' % URL_PREFIX)), escape=False) m["content"] = util.linkify(data["text"], ((util.PARSE_HASH, '#<a class="hash" href="gwibber:/tag?acct=%s&query=\\1">\\1</a>' % m["account"]), (util.PARSE_NICK, '@<a class="nick" href="gwibber:/user?acct=%s&name=\\1">\\1</a>' % m["account"])), escape=False) images = util.imgpreview(m["text"]) if images: m["images"] = images except: log.logger.error("%s failure - %s", PROTOCOL_INFO["name"], data) return m
def _common(self, data): m = {} try: m["mid"] = str(data["id"]) m["service"] = "identica" m["account"] = self.account["id"] m["time"] = util.parsetime(data["created_at"]) m["source"] = data.get("source", False) m["text"] = data["text"] m["to_me"] = ("@%s" % self.account["username"]) in data["text"] m["html"] = util.linkify( m["text"], ((util.PARSE_HASH, '#<a class="hash" href="%s#search?q=\\1">\\1</a>' % URL_PREFIX), (util.PARSE_NICK, '@<a class="nick" href="%s/\\1">\\1</a>' % URL_PREFIX))) m["content"] = util.linkify(m["text"], (( util.PARSE_HASH, '#<a class="hash" href="gwibber:/tag?acct=%s&query=\\1">\\1</a>' % m["account"] ), (util.PARSE_NICK, '@<a class="nick" href="gwibber:/user?acct=%s&name=\\1">\\1</a>' % m["account"]))) images = [] if data.get("attachments", 0): for a in data["attachments"]: mime = a.get("mimetype", "") if mime and mime.startswith("image") and a.get("url", 0): images.append({"src": a["url"], "url": a["url"]}) images.extend(util.imgpreview(m["text"])) if images: m["images"] = images except: log.logger.error("%s failure - %s", PROTOCOL_INFO["name"], data) return m