Compare commits
2 Commits
8ad93caa90
...
02fd0ae13e
Author | SHA1 | Date | |
---|---|---|---|
02fd0ae13e
|
|||
85e1d74a1d
|
33
cgi.py
33
cgi.py
@@ -1,33 +0,0 @@
|
||||
# https://github.com/python/cpython/blob/3511c2e546aaacda5880eb89a94f4e8514b3ce76/Lib/cgi.py#L226-L256
|
||||
|
||||
def _parseparam(s):
|
||||
while s[:1] == ';':
|
||||
s = s[1:]
|
||||
end = s.find(';')
|
||||
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
|
||||
end = s.find(';', end + 1)
|
||||
if end < 0:
|
||||
end = len(s)
|
||||
f = s[:end]
|
||||
yield f.strip()
|
||||
s = s[end:]
|
||||
|
||||
def parse_header(line):
|
||||
"""Parse a Content-type like header.
|
||||
|
||||
Return the main content-type and a dictionary of options.
|
||||
|
||||
"""
|
||||
parts = _parseparam(';' + line)
|
||||
key = parts.__next__()
|
||||
pdict = {}
|
||||
for p in parts:
|
||||
i = p.find('=')
|
||||
if i >= 0:
|
||||
name = p[:i].strip().lower()
|
||||
value = p[i+1:].strip()
|
||||
if len(value) >= 2 and value[0] == value[-1] == '"':
|
||||
value = value[1:-1]
|
||||
value = value.replace('\\\\', '\\').replace('\\"', '"')
|
||||
pdict[name] = value
|
||||
return key, pdict
|
@@ -38,7 +38,7 @@ class Scraper(ClientSession):
|
||||
only_notice: bool = False,
|
||||
search_type: Optional[SearchType] = None,
|
||||
search_position: Optional[int] = None,
|
||||
search_value: Optional[str] = None
|
||||
search_value: Optional[str] = None
|
||||
) -> List[Post]:
|
||||
"""
|
||||
특정 게시판으로부터 특정 조건에 맞는 게시글 목록을 가져옵니다
|
||||
|
Reference in New Issue
Block a user