- 源于看到论坛某些坛友写的爬虫代码而分享的一点思路,希望更多的小白在走我们这些路子的时候,不再拐那么多弯。
- 这是一个关于pixivic二次元动漫网站的一个爬虫源码的部分
- 没有发布所有的源码,因为我自己也没去写
如下源码可以直接获取到该网站的api,只是匆忙看了一眼发出来,我并未去核实完整性和码代码
import requests,json,datetime
nowtime = datetime.datetime.now().strftime('%F')
nowtime = str(nowtime)
url = 'https://api.pixivic.com/trendingTags?date=' + nowtime
r = requests.get(url).json()
print(r)
部分json数据如下:
"name":"斯卡蒂",
"translatedName":"Skadi",
"id":null
},
{
"name":"スカジ(アークナイツ)",
"translatedName":"Skadi (Arknights)",
"id":null
},
{
"name":"女の子",
"translatedName":"女孩子",
"id":null
},
{
"name":"水着",
"translatedName":"泳装",
"id":null
},
{
"name":"裸足",
"translatedName":"赤脚",
"id":null
},
{
"name":"つま先",
"translatedName":"脚趾",
"id":null
},
{
"name":"おっぱい",
"translatedName":"欧派",
"id":null
}
],
"imageUrls":[
{
"squareMedium":"https://i.pximg.net/c/360x360_10_webp/img-master/img/2020/08/12/15/45/22/83624375_p0_square1200.jpg",
"medium":"https://i.pximg.net/c/540x540_70/img-master/img/2020/08/12/15/45/22/83624375_p0_master1200.jpg",
"large":"https://i.pximg.net/c/600x1200_90_webp/img-master/img/2020/08/12/15/45/22/83624375_p0_master1200.jpg",
"original":"https://i.pximg.net/img-original/img/2020/08/12/15/45/22/83624375_p0.jpg"
},
{
"squareMedium":"https://i.pximg.net/c/360x360_10_webp/img-master/img/2020/08/12/15/45/22/83624375_p1_square1200.jpg",
"medium":"https://i.pximg.net/c/540x540_70/img-master/img/2020/08/12/15/45/22/83624375_p1_master1200.jpg",
"large":"https://i.pximg.net/c/600x1200_90_webp/img-master/img/2020/08/12/15/45/22/83624375_p1_master1200.jpg",
"original":"https://i.pximg.net/img-original/img/2020/08/12/15/45/22/83624375_p1.jpg"
}
],
"tools":[
"Procreate"
],
"createDate":"2020-08-12",
"pageCount":2,
"width":2890,
"height":4046,
"sanityLevel":2,
"restrict":0,
"totalView":7661,
"totalBookmarks":2890,
"xrestrict":0
}
},