# -*- coding:utf-8 -*-
import socket

s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('www.bilibili.com', 80))

s.send(b'GET /HTTP/1.1\r\nHost:www.bilibili.com\r\nConnection:close\r\n\r\n')
buffer=[]
while True:
	d=s.recv(1024)
	if d:
		buffer.append(d)
	else:
		break
data=b''.join(buffer)
s.close()

header, html = data.split(b'\r\n\r\n', 1)
print(header.decode('utf-8'))
# 把接收的数据写入文件:
with open('sina.html', 'wb') as f:
    f.write(html)
9088af991ca128e85550708cbddddf45af963d56
<mask token>

<mask token>
s.connect(('www.bilibili.com', 80))
s.send(b'GET /HTTP/1.1\r\nHost:www.bilibili.com\r\nConnection:close\r\n\r\n')
<mask token>
while True:
    d = s.recv(1024)
    if d:
        buffer.append(d)
    else:
        break
<mask token>
s.close()
<mask token>
print(header.decode('utf-8'))
with open('sina.html', 'wb') as f:
    f.write(html)

<mask token>
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('www.bilibili.com', 80))
s.send(b'GET /HTTP/1.1\r\nHost:www.bilibili.com\r\nConnection:close\r\n\r\n')
buffer = []
while True:
    d = s.recv(1024)
    if d:
        buffer.append(d)
    else:
        break
data = b''.join(buffer)
s.close()
header, html = data.split(b'\r\n\r\n', 1)
print(header.decode('utf-8'))
with open('sina.html', 'wb') as f:
    f.write(html)

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('www.bilibili.com', 80))
s.send(b'GET /HTTP/1.1\r\nHost:www.bilibili.com\r\nConnection:close\r\n\r\n')
buffer = []
while True:
    d = s.recv(1024)
    if d:
        buffer.append(d)
    else:
        break
data = b''.join(buffer)
s.close()
header, html = data.split(b'\r\n\r\n', 1)
print(header.decode('utf-8'))
with open('sina.html', 'wb') as f:
    f.write(html)

# -*- coding:utf-8 -*-
import socket

s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('www.bilibili.com', 80))

s.send(b'GET /HTTP/1.1\r\nHost:www.bilibili.com\r\nConnection:close\r\n\r\n')
buffer=[]
while True:
	d=s.recv(1024)
	if d:
		buffer.append(d)
	else:
		break
data=b''.join(buffer)
s.close()

header, html = data.split(b'\r\n\r\n', 1)
print(header.decode('utf-8'))
# 把接收的数据写入文件:
with open('sina.html', 'wb') as f:
    f.write(html)