'''
Request URL:https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action=&start=20&limit=20
type:11
interval_id:100:90
action:
start:20
limit:20
'''

from urllib import request
import json

# for i in range(28):
#     start = i * 20
#     base_url = 'https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action=&start='+str(start)+'&limit=20'
#
#     response = request.urlopen(base_url)
#
#     html = response.read()
#     html = html.decode('utf-8')
#     # html = html.split('},')
#     # json_data = json.loads(html)
#     print(html)

base_url = 'https://movie.douban.com/j/chart/top_list?type=13&interval_id=100%3A90&action=&start=0&limit=28'

response = request.urlopen(base_url)

html = response.read()
html = html.decode('utf-8')
print(type(html))

#json格式化能把上面的str数据类型改为可以迭代的list类型
json_data = json.loads(html)
print(type(json_data))
x = 1
for i in json_data:
    print(x,i['title'])
    x +=

 

相关文章:

  • 2022-01-18
  • 2021-08-11
  • 2021-10-08
  • 2022-02-04
  • 2021-05-07
  • 2021-08-20
  • 2021-11-19
  • 2022-02-08
猜你喜欢
  • 2021-12-04
  • 2021-07-15
  • 2021-11-06
  • 2022-12-23
  • 2021-10-07
  • 2021-10-13
相关资源
相似解决方案