def get_content(self) -> str: contents = "" contents += " " + "\r\n" contents += "╭───────────────────────╮ " + "\r\n" contents += "│\x15[1;33m http://goo.gl/hKilDn 即時影音連結 \x15[m│ " + "\r\n" contents += "│\x15[1;33m https://akb48-bili.tenten.tw/ B站撈取網頁 \x15[m│ " + "\r\n" contents += "╰───────────────────────╯ " + "\r\n" contents += " https://bit.ly/2M9ATbS 程式開源 有需要可自取" + "\r\n" contents += " " + "\r\n" contents += "相關討論discord https://discord.gg/vXvk6D2 內有很多頻道可討論 \r\n" contents += " " + "\r\n" # 歷史上的今天 成員生日 contents += "\x15[1;43m \x15[40m■ \x15[33m歷史上的今天\x15[37m■\x15[43m \x15[m " + "\r\n" contents += " " + "\r\n" contents += self.get_birth() # 今日媒體行程 query_date = datetime.datetime.today().strftime("%Y/%m/%d") contents += "\x15[1;46m \x15[40m■今日媒體行程■\x15[46m \x15[m " + "\r\n" contents += " " + "\r\n" for key in self.__SCHEDULE_TITLE_FORMAT__.keys(): contents += self.get_schedule(key, query_date) contents += " " + "\r\n" # 找劇場 contents += " " + "\r\n" contents += " " + "\r\n" contents += " " + "\r\n" contents += "\x15[1;42m \x15[40m■劇場公演情報■\x15[42m \x15[m" + "\r\n" contents += " " + "\r\n" contents += self.get_theater(query_date) # 找影音連結 contents += " " + "\r\n" contents += " " + "\r\n" contents += " " + "\r\n" contents += "\x15[1;44m \x15[40m■影音連結整理■\x15[44m \x15[m" + "\r\n" contents += " " + "\r\n" contents += " " + "\r\n" contents += self.get_video() contents += " " + "\r\n" contents += "※ 影音整理:fatetree \r\n" register_uao() contents = contents.encode("big5-uao", 'replace').decode("big5-uao", 'replace') return contents
# -*- coding: utf-8 -*- import uao uao.register_uao() u = u"一小段中文測試♥一小段中文测试♥中国の短いテスト♥" b = b"\xa4\x40\xa4\x70\xac\x71\xa4\xa4\xa4\xe5\xb4\xfa\xb8\xd5\x9d\xde\xa4\x40\xa4\x70\xac\x71\xa4\xa4\xa4\xe5\x84\xf2\x86\x49\x9d\xde\xa4\xa4\x83\xf6\xc7\x55\xb5\x75\xc6\xea\xc7\xc2\xc7\xb5\xc7\xc4\x9d\xde" assert u.encode("big5-uao") == b assert b.decode("big5-uao") == u
import time import asyncio import websockets import telnetlib import re import traceback import threading from uao import register_uao register_uao() try: from . import data_type from . import i18n from . import log from . import screens from . import command from . import exceptions from . import version except ModuleNotFoundError: import data_type import i18n import log import screens import command import exceptions import version websockets.http.USER_AGENT += f' PyPtt/{version.V}'