(f)
| 47 | @SeekZero |
| 48 | @EOFAsNone |
| 49 | def ProbeCommentFormat(f): |
| 50 | tmp = f.read(1) |
| 51 | if tmp == '[': |
| 52 | return 'Acfun' |
| 53 | # It is unwise to wrap a JSON object in an array! |
| 54 | # See this: http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx/ |
| 55 | # Do never follow what Acfun developers did! |
| 56 | elif tmp == '{': |
| 57 | tmp = f.read(14) |
| 58 | if tmp == '"status_code":': |
| 59 | return 'Tudou' |
| 60 | elif tmp == '"root":{"total': |
| 61 | return 'sH5V' |
| 62 | elif tmp == '<': |
| 63 | tmp = f.read(1) |
| 64 | if tmp == '?': |
| 65 | tmp = f.read(38) |
| 66 | if tmp == 'xml version="1.0" encoding="UTF-8"?><p': |
| 67 | return 'Niconico' |
| 68 | elif tmp == 'xml version="1.0" encoding="UTF-8"?><i': |
| 69 | return 'Bilibili' |
| 70 | elif tmp == 'xml version="1.0" encoding="utf-8"?><i': |
| 71 | return 'Bilibili' # tucao.cc, with the same file format as Bilibili |
| 72 | elif tmp == 'xml version="1.0" encoding="Utf-8"?>\n<': |
| 73 | return 'Bilibili' # Komica, with the same file format as Bilibili |
| 74 | elif tmp == 'xml version="1.0" encoding="UTF-8"?>\n<': |
| 75 | return 'MioMio' |
| 76 | elif tmp == 'p': |
| 77 | return 'Niconico' # Himawari Douga, with the same file format as Niconico Douga |
| 78 | |
| 79 | |
| 80 | # |
no outgoing calls
no test coverage detected