资源简介

使用Python requests库爬取淘宝商品价格

资源截图

代码片段和文件信息


import requests

import re

 

def getHTMLText(url): #获得页面函数淘宝需要登录验证,暂时访问不了

    try:

        header={

            ‘user-agent‘:‘Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/63.0.3239.132 Safari/537.36‘

            ‘cookie‘:‘cookie2=11c16410d3a6142b1fdd7a16015dd03d; t=09f34aa2c73f130d6c7184f5df19318f; _tb_token_=387eb33dee36b; cna=3M6cFtwvoFgCAXLchLEf1mZd; v=0; unb=2015695879; uc3=vt3=F8dBxdkOfjJ3eDeXSSI%3D&lg2=V32FPkk%2Fw0dUvg%3D%3D&nk2=tacC1tKNp%2Flo&id2=UUjQnXynNxyppA%3D%3D; csg=0b016f75; lgc=%5Cu6731%5Cu5B5C%5Cu8F69zzx; cookie17=UUjQnXynNxyppA%3D%3D; dnk=%5Cu6731%5Cu5B5C%5Cu8F69zzx; skt=24b614735d33b345; existShop=MTU3ODQ5MjE0MA%3D%3D; uc4=nk4=0%40txMJ9z03E8Z3GRFQEHZ3NdNLHdU%3D&id4=0%40U2oyV9BEdCasU86z%2Bh8TF2rESQec; tracknick=%

评论

共有 条评论