forked from jaydenwen123/GolangSpider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3ed198
commit faea55a
Showing
7 changed files
with
1,093 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,98 @@ | ||
# Pexels图片素材网 # | ||
|
||
> The best free stock photos & videos shared by talented creators. | ||
> 该网站主要提供一些免费的图片素材和视频,并支持不同尺寸的图片下载 | ||
网站首页: | ||
|
||
![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/home.png) | ||
|
||
网站搜索接口: | ||
|
||
![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/search.png) | ||
|
||
|
||
## 主要任务 ## | ||
|
||
1.分析搜索接口 | ||
|
||
>//中文: | ||
>zhPageUrl=`https://www.pexels.com/zh-cn/search/{keyword}/?format=html&page={page}&type=` | ||
>//英文: | ||
>enPageUrl=`https://www.pexels.com/search/{keyword}/?format=html&page={page}&type=` | ||
> | ||
2.提供输入关键词和中英文两种语言的支持 | ||
|
||
3.并发解析搜索到的图片 | ||
|
||
4.保存图片关键信息(图片尺寸、图片链接等) | ||
|
||
5.并发下载图片保存到本地 | ||
|
||
>下载不同尺寸的图片链接: | ||
> pictureUrl=`{url}?crop=entropy&cs=srgb&fit=crop&fm=jpg&h={height}&w={width}` | ||
> | ||
## 爬虫成果 ## | ||
|
||
**1.测试中文搜索词** | ||
|
||
> 选择语言,并提供搜索词 选择`李连杰`(该网站中文的搜索词搜索到的图片不准确) | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/zhtest1.png) | ||
> 下载图片 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/zhtest2.png) | ||
> 下载日志 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/zhtest3.png) | ||
> 下载完毕 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/zhtest4.png) | ||
> 本地图片 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/lilianjie.png) | ||
|
||
**2.测试英文搜索词** | ||
|
||
> 选择语言,并提供搜索词 选择`artificial intelligence`(该网站中文的搜索词搜索到的图片不准确) | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/test1.png) | ||
> 下载图片 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/test2.png) | ||
> 下载日志 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/test3.png) | ||
> 下载完毕 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/test4.png) | ||
> 本地图片 | ||
> | ||
> ![Pexels图片素材网](https://github.com/jaydenwen123/GolangSpider/blob/master/GolangSpider/example/pexels/example_images/artificial_intelligence.png) | ||
|
||
## 涉及技术 ## | ||
|
||
1. goroutine&channel并发 | ||
2. html解析库——goquery的使用 | ||
3. json解析库——gjson库的使用 | ||
|
||
## 参考资料 ## | ||
|
||
1. [Go-Spider 大牛的爬虫网址](https://github.com/GopherCoder/Go-Spider) | ||
2. [goquery github链接](https://github.com/PuerkitoBio/goquery) | ||
3. [gjson github链接](https://github.com/tidwall/gjson) | ||
4. [gobyexample 网址](https://gobyexample.com/) | ||
|
||
pexels |
This file was deleted.
Oops, something went wrong.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
993 changes: 992 additions & 1 deletion
993
GolangSpider/example/pexels/picture/artificial intelligence/第1页.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"GolangSpider/GolangSpider/example/gushiwen" | ||
"fmt" | ||
) | ||
import "GolangSpider/GolangSpider/example/pexels" | ||
|
||
func main() { | ||
//fmt.Println("爬取cbooo的数据") | ||
//cbooo.Main() | ||
fmt.Println("爬取古诗文的数据") | ||
gushiwen.Main() | ||
//fmt.Println("爬取古诗文的数据") | ||
//gushiwen.Main() | ||
//fmt.Println("爬取酷狗音乐的歌曲数据") | ||
//kugou.Main() | ||
//pexels.Search() | ||
pexels.Search() | ||
} |