import requests
import json
import re
headers = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
'cookie':'__yadk_uid=5kyh1UjidxhqlWFtKOx7cqon44UgzkTr; remember_user_token=W1sxNzkzMzQ0M10sIiQyYSQxMSRTR2U2eWZVaWYwWWpOY09DQ1BpR1cuIiwiMTU2MDQwMzUzNC4yNDE3NzI3Il0%3D--3f57c1a8eb169a27e092cac40772f8fe8ad35d57; _m7e_session_core=71caea6afa797c0017263c8d9b2067a3; read_mode=day; default_font=font2; locale=zh-CN; Hm_lvt_0c0e9d9b1e7d617b3e6842e85b9fb068=1560351677,1560357123,1560403537,1560429514; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2217933443%22%2C%22%24device_id%22%3A%2216b4c3528f0160-05fc10a3004fbc-e353165-1049088-16b4c35293716c%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_referrer%22%3A%22%22%2C%22%24latest_referrer_host%22%3A%22%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%7D%2C%22first_id%22%3A%2216b4c3528f0160-05fc10a3004fbc-e353165-1049088-16b4c35293716c%22%7D; Hm_lpvt_0c0e9d9b1e7d617b3e6842e85b9fb068=1560431154'
}
url = 'https://www.jianshu.com/subscriptions/6931170'
def get_info(url):
res = requests.get(url,headers=headers)
json_data = json.loads(res.text)
# print(res.text)
sources = json_data['source']['notes']
for source in sources:
title = source['title']
nickname = source['author']['nickname']
public_abbr = source['public_abbr']
print(nickname,title,public_abbr)
get_info(url)
Python作业4:通过提交cookie模拟登陆简书,爬取简友圈内容
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- github地址:https://github.com/haoxinl/spider_python 博客地址:ht...