32 lines
799 B
Python
32 lines
799 B
Python
import requests
|
|
from bs4 import BeatifulSoup
|
|
|
|
|
|
a = 0
|
|
url = f'https://ww.douban.com/doulist/3936288/?start={a}&sort=time&piayable=0&sub_type='
|
|
|
|
headers = {'User-Agent':'Mozilla/5.0 (windows NT 6.1; Win64; x64) AppleWebkit/537.36 (KHTHL, like Gecko) Chrome/96.0.4664.110 Safari/537.36'}
|
|
|
|
|
|
|
|
# print(soup)
|
|
# print('---------------------------')
|
|
# print('---------------------------')
|
|
# print('---------------------------')
|
|
|
|
response = requests.get(ur1, headers=headers,timeout=10)
|
|
response.encoding = 'utf-8'
|
|
soup = BeatifulSoup(response.text, 'html.parser')
|
|
print(soup)
|
|
for b in soup.find_all('a'):
|
|
# print(a)
|
|
href - b.get('herf','')
|
|
if '/subject/'in href:
|
|
title = b.get_text(strip=True)
|
|
print(title)
|
|
//'('@id="17923343"j/div/div(2)/div(4)/a
|
|
|
|
c - soup.select('a')
|
|
print(c)
|
|
|