shadowsocksr-speed icon indicating copy to clipboard operation
shadowsocksr-speed copied to clipboard

有一些不应该解码的或者解码错误的ssr链接,应该予以过滤

Open Neboer opened this issue 6 years ago • 0 comments

https://github.com/mobier/shadowsocksr-speed/blob/3b78ee6db957dfe4305760e296bc09bcd8a0b443/ParseSsr.py#L16

可以把解析错误的信息catch住并抛弃,只解析有用的链接。因为有些链接仅仅是为了显示流量等等信息,并没有一并解析的价值。

Traceback (most recent call last):
  File "shadowsocksr-speed.py", line 323, in <module>
    ssr_config.append(ParseSsr.parse(decdata))#解析"SSR://" 后边的base64的配置信息返回一个字典
  File "/home/neboer/Document/shadowsocksr-speed/ParseSsr.py", line 29, in parse
    decode_str = base64_decode(ssrUrl)
  File "/home/neboer/Document/shadowsocksr-speed/ParseSsr.py", line 16, in base64_decode
    return base64.urlsafe_b64decode(base64_encode_str).decode('utf-8')
  File "/usr/lib/python3.7/base64.py", line 133, in urlsafe_b64decode
    return b64decode(s)
  File "/usr/lib/python3.7/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (14853) cannot be 1 more than a multiple of 4

Neboer avatar Aug 22 '19 23:08 Neboer