All Projects → Py-Script → tuchong_Spider

Py-Script / tuchong_Spider

Licence: other
⭐ 图虫网爬虫

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to tuchong Spider

young-crawler
scala结合actor编写的分布式网络爬虫
Stars: ✭ 15 (-6.25%)
Mutual labels:  spider
Web-Iota
Iota is a web scraper which can find all of the images and links/suburls on a webpage
Stars: ✭ 60 (+275%)
Mutual labels:  spider
TaobaoSpider
This taobao spider has been archived
Stars: ✭ 28 (+75%)
Mutual labels:  spider
ben-ben-spider
犇犇爬虫
Stars: ✭ 36 (+125%)
Mutual labels:  spider
scrapy helper
Dynamic configurable crawl (动态可配置化爬虫)
Stars: ✭ 84 (+425%)
Mutual labels:  spider
gospider
⚡ Light weight Golang spider framework | 轻量的 Golang 爬虫框架
Stars: ✭ 183 (+1043.75%)
Mutual labels:  spider
imdb-spider
scrapy spider for scraping imdb {movie_id: [recommended, ...]}
Stars: ✭ 23 (+43.75%)
Mutual labels:  spider
gathertool
gathertool是golang脚本化开发库,目的是提高对应场景程序开发的效率;轻量级爬虫库,接口测试&压力测试库,DB操作库等。
Stars: ✭ 36 (+125%)
Mutual labels:  spider
GitHub-Trending-Crawler
Crawling GitHub Trending Pages every day
Stars: ✭ 55 (+243.75%)
Mutual labels:  spider
grapy
Grapy, a fast high-level web crawling framework for Python 3.3 or later base on asyncio.
Stars: ✭ 18 (+12.5%)
Mutual labels:  spider
Spider
资讯爬虫App
Stars: ✭ 24 (+50%)
Mutual labels:  spider
bilibili-smallvideo
🕷️用于爬取B站前top100的小视频
Stars: ✭ 133 (+731.25%)
Mutual labels:  spider
crawler-chrome-extensions
爬虫工程师常用的 Chrome 插件 | Chrome extensions used by crawler developer
Stars: ✭ 53 (+231.25%)
Mutual labels:  spider
BaiduSpider
项目已经移动至:https://github.com/BaiduSpider/BaiduSpider !! 一个爬取百度搜索结果的爬虫,目前支持百度网页搜索,百度图片搜索,百度知道搜索,百度视频搜索,百度资讯搜索,百度文库搜索,百度经验搜索和百度百科搜索。
Stars: ✭ 29 (+81.25%)
Mutual labels:  spider
ZSpider
基于Electron爬虫程序
Stars: ✭ 37 (+131.25%)
Mutual labels:  spider
simpyder
超高速异步协程Python爬虫
Stars: ✭ 74 (+362.5%)
Mutual labels:  spider
main project
基于nodejs的网络聊天室、爬虫,vue音乐播放器,及php后台开发的管理系统等项目
Stars: ✭ 49 (+206.25%)
Mutual labels:  spider
php-crawler
🕷️ A simple crawler (spider) writen in php just for fun, with zero dependencies
Stars: ✭ 39 (+143.75%)
Mutual labels:  spider
article-spider
文章采集工具 Article collection tool
Stars: ✭ 130 (+712.5%)
Mutual labels:  spider
weixin article spiders
A spiders' program for weixin which made by Express & cheerio
Stars: ✭ 33 (+106.25%)
Mutual labels:  spider

TuChong_Spider

偶然的机会在抖音看到这个APP,发现有很多高质量的手机壁纸和图片,对于一个爬虫初学者,这就非常美滋滋了,好多欧美小姐姐啊,哎嘿嘿....

图虫网共享图库爬虫, 通过抓取Ajax获取图片ID进行图片保存

爬取网站: https://stock.tuchong.com

爬取结果

运行环境:

  • Python 3.5+
  • Windows 10
  • VSCode

如何使用

下载项目源码

https://github.com/cexll/tuchong_Spider.git

安装依赖

$ pip install -r requirements.txt

运行项目

$ python spider.py
输入想要搜索的内容: 少女
获取图片ID.....
解析imageID
存在ID,解析
解析HTML图片URL...
准备下载... //p3a.pstatp.com/weili/l/199813*************89.jpg
下载成功----------------------
拼接url访问网页
解析HTML图片URL...
准备下载... //p3a.pstatp.com/weili/l/189***********417.jpg
下载成功----------------------
拼接url访问网页
解析HTML图片URL...
准备下载... //p3a.pstatp.com/weili/l/1**************25.png
拼接url访问网页
解析HTML图片URL...
准备下载... //p3a.pstatp.com/weili/l/2***********62820.jpg
拼接url访问网页
解析HTML图片URL...
准备下载... //p3a.pstatp.com/weili/l/************2.jpg
拼接url访问网页
...

图片链接我就大码了

思路(前方高能,请流量党注意)

首先爬取一个网页,第一步,先打开这个网页

打开之后,先看看怎么搜索图片,下载图片的..

可以看到,图虫网的图片还是不错的

回到正题~

打开开发者工具(F12 或者右键 ,然后刷新

然后看一看有没有什么有用的东西....好像仔细找了找是没有发现什么有用的...怎么办呢?

网页往下翻一翻,,,,,

图片中间出现了个数据包....这就是我们需要的东西,,但是打开发现不对啊,怎么没有图片下载的链接??

哎,别慌,先去网页打开一个图片看看是什么结构的...

到这里我们发现了,网页url链接有个imageID=这东西,好像和之前找到个数据包内容是一样的,,,打开后发现的确是一样的

那么整体的结构就清楚了,先把刚才的数据包链接打开看看是什么

仔细看了看,发现最开始都有imageID,那么思路就有了

通过访问数据包的链接得到每一页的imageID,在用 https://stock.tuchong.com/free/image/? + imageID就可以访问到图片了,好的 coding

代码

总结

抓取所有的网页都是类似的思路,首先先通过人的逻辑去找到数据,在通过代码去得到,不要一来就上手代码,

细心的朋友肯定发现了,我们抓的是免费图库里的图片,是的,至于为什么不抓优选图库,高端图库,1是我也是才发现他们不一样,2是别人赚钱的生意我就这样发出来了万一被抓了怎么办....

有能力的可以自己去琢磨一下,我上次看了一下imageID这次是保存在HTML里面的,有点类似今日头条的

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].