08 2021 档案

摘要:###1.将字符串的时间转换为时间戳 import time a = "2021-08-31 11:00:00" # 将其转换为时间数组 timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S") # 转换为时间戳 timeStamp = int(time.m 阅读全文
posted @ 2021-08-31 13:36 莫贞俊晗 阅读(1512) 评论(0) 推荐(0) 编辑
摘要:什么是增量爬虫 爬虫过程中,常常要对目标网站的新数据进行抓取,遇到已经爬过的网页需要进行过滤。本文介绍用redis数据库的高效去重。 把所有爬过的url都放在redis中,以后每次爬取链接之前,先把url添加进去,如果能添加进去,说明是没爬过的,如果添加不进去,说明该链接有爬取过。 ###方法1 普 阅读全文
posted @ 2021-08-26 18:10 莫贞俊晗 阅读(548) 评论(0) 推荐(0) 编辑
摘要:###识别图片链接尺寸大小 # 封面链接 url = "https://ci.xiaohongshu.com/5b8597c2-23ea-36ef-7340-c3ee59da9b3b?imageView2/2/w/1080/format/jpg" response = u.urlopen(url) 阅读全文
posted @ 2021-08-17 17:09 莫贞俊晗 阅读(418) 评论(0) 推荐(0) 编辑
摘要:###1.几小时前换算时间戳 now_time = int(time.time()) print(now_time) timeArray = datetime.datetime.utcfromtimestamp(time_now1) print(timeArray) # 加8小时时区,再减几小时前时 阅读全文
posted @ 2021-08-12 17:33 莫贞俊晗 阅读(250) 评论(0) 推荐(0) 编辑
摘要:import re htmlString = '<a href="https://m.weibo.cn/p/index?containerid=100808edb33656f8aaf7c68add26ad8d0fdba4&extparam=%E6%97%A9%E9%A4%90&luicode=100 阅读全文
posted @ 2021-08-11 17:53 莫贞俊晗 阅读(215) 评论(0) 推荐(0) 编辑
摘要:###base64解码 import base64 import warnings warnings.filterwarnings("ignore") content = 'eyJ1IjoiNTc5NGQ0ZjAtZjY2YS0xMWViLWI4ZjMtNzNiMDQ0YzM2M2YyIiwidiI 阅读全文
posted @ 2021-08-06 15:20 莫贞俊晗 阅读(96) 评论(0) 推荐(0) 编辑
摘要:###字典排序之后md5 import time import hashlib import requests def hash_md5(): params ={ "past_num":"20", # "banner_log":"", "tab_id":"116", "smzdm_id":"0", 阅读全文
posted @ 2021-08-06 11:22 莫贞俊晗 阅读(39) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示