| 14 | self.checkout_map = {} |
| 15 | |
| 16 | def check(self, url): |
| 17 | conn = utils.http_req(url, method="get", timeout=self.timeout, stream=True) |
| 18 | conn.close() |
| 19 | |
| 20 | if conn.status_code == 400: |
| 21 | # 特殊情况排除 |
| 22 | etag = conn.headers.get("ETag") |
| 23 | date = conn.headers.get("Date") |
| 24 | if not etag or not date: |
| 25 | return None |
| 26 | |
| 27 | # *** 特殊情况过滤 |
| 28 | if conn.status_code == 422 or conn.status_code == 410: |
| 29 | return None |
| 30 | |
| 31 | if (conn.status_code >= 501) and (conn.status_code < 600): |
| 32 | return None |
| 33 | |
| 34 | if conn.status_code == 403: |
| 35 | conn2 = utils.http_req(url) |
| 36 | check = b'</title><style type="text/css">body{margin:5% auto 0 auto;padding:0 18px}' |
| 37 | if check in conn2.content: |
| 38 | return None |
| 39 | |
| 40 | item = { |
| 41 | "status": conn.status_code, |
| 42 | "content-type": conn.headers.get("Content-Type", "") |
| 43 | } |
| 44 | |
| 45 | return item |
| 46 | |
| 47 | def work(self, url): |
| 48 | try: |