浏览代码

Always decode stdin with surrogateescape to avoid breaking on binary input

master
JustAnotherArchivist 2 年前
父节点
当前提交
6e5a019d9e
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. +2
    -1
      youtube-extract

+ 2
- 1
youtube-extract 查看文件

@@ -110,7 +110,8 @@ matchers = [
for e in matchers:
e[0] = re.compile(e[0])

for origLine in sys.stdin:
for origLine in sys.stdin.buffer:
origLine = origLine.decode('utf-8', 'surrogateescape')
origLine = origLine.strip()
line = re.sub(r'https?://', '//', origLine)
line = domainPattern.sub('/www.youtube.com/', line)


正在加载...
取消
保存