Skip to content

Commit

Permalink
feat: add new SVG icons and remove deprecated spider constants
Browse files Browse the repository at this point in the history
- Introduced new SVG icons for Cheerio, Crawlee, Drission Page, Web Magic, and XXL-Crawler to enhance the visual representation of spider templates.
- Removed deprecated constants related to spider types from the constants and interfaces, streamlining the codebase.
- Updated the spider template options to include new templates in the model, improving flexibility in spider configurations.
- Enhanced the spider template management UI to accommodate the new icons and templates, providing a more intuitive user experience.

These changes improve the overall functionality and visual consistency of the spider management interface.
  • Loading branch information
Marvin Zhang committed Jan 7, 2025
1 parent edf5df8 commit a79f856
Show file tree
Hide file tree
Showing 10 changed files with 322 additions and 41 deletions.
4 changes: 4 additions & 0 deletions src/assets/svg/icons/cheerio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions src/assets/svg/icons/crawlee.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions src/assets/svg/icons/drission-page.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions src/assets/svg/icons/webmagic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions src/assets/svg/icons/xxl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export * from './os';
export * from './plugin';
export * from './router';
export * from './sort';
export * from './spider';
export * from './tab';
export * from './table';
export * from './task';
Expand Down
2 changes: 0 additions & 2 deletions src/constants/spider.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/interfaces/components/core/spider/SpiderType.d.ts

This file was deleted.

14 changes: 10 additions & 4 deletions src/interfaces/models/spider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,21 @@ export declare global {

type SpiderTemplateName =
| 'scrapy'
| 'scrapy-redis'
| 'bs4'
| 'selenium'
| 'drission-page'
| 'pyppeteer'
| 'crawlee-python'
| 'puppeteer'
| 'playwright'
| 'cheerio'
| 'crawlee'
| 'colly'
| 'python'
| 'node'
| 'go'
| 'java';
| 'goquery'
| 'jsoup'
| 'webmagic'
| 'xxl-crawler';

interface SpiderTemplateParams {
spider_name?: string;
Expand Down
90 changes: 68 additions & 22 deletions src/utils/spider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ export const getSpiderTemplateGroups = (): SpiderTemplateGroup[] => {
{
name: 'scrapy',
label: 'Scrapy',
cmd: 'scrapy crawl scrapy_spider',
cmd: 'scrapy crawl quotes',
icon: ['svg', 'scrapy'],
params: {
spider_name: 'scrapy_spider',
start_urls: 'http://example.com',
domains: 'example.com',
},
doc_url: 'https://docs.scrapy.org/en/latest/intro/overview.html',
doc_label: 'Scrapy Documentation',
},
{
name: 'scrapy-redis',
label: 'Scrapy Redis',
cmd: 'scrapy crawl quotes',
icon: ['svg', 'redis'],
doc_url: 'https://github.com/rmax/scrapy-redis',
doc_label: 'Scrapy Redis Documentation',
},
{
name: 'bs4',
label: 'BeautifulSoup',
Expand All @@ -38,12 +41,28 @@ export const getSpiderTemplateGroups = (): SpiderTemplateGroup[] => {
doc_label: 'Selenium Documentation',
},
{
name: 'python',
label: 'Basic Python',
icon: ['fab', 'python'],
name: 'drission-page',
label: 'DrissionPage',
icon: ['svg', 'drission-page'],
cmd: 'python main.py',
doc_url: 'https://drissionpage.cn/',
doc_label: 'DrissionPage Documentation',
},
{
name: 'pyppeteer',
label: 'Pyppeteer',
icon: ['svg', 'puppeteer'],
cmd: 'python main.py',
doc_url: 'https://miyakogi.github.io/pyppeteer/',
doc_label: 'Pyppeteer Documentation',
},
{
name: 'crawlee-python',
label: 'Crawlee Python',
icon: ['svg', 'crawlee'],
cmd: 'python main.py',
doc_url: `https://www.python.org/`,
doc_label: 'Python Documentation',
doc_url: 'https://crawlee.dev/docs/quick-start/python',
doc_label: 'Crawlee Python Documentation',
},
],
},
Expand All @@ -69,12 +88,20 @@ export const getSpiderTemplateGroups = (): SpiderTemplateGroup[] => {
doc_label: 'Playwright Documentation',
},
{
name: 'node',
label: 'Basic Node.js',
icon: ['fab', 'node-js'],
name: 'cheerio',
label: 'Cheerio',
icon: ['svg', 'cheerio'],
cmd: 'node main.js',
doc_url: `https://nodejs.org/${locale === 'zh' ? 'zh-cn' : 'en'}/`,
doc_label: 'Node.js Documentation',
doc_url: 'https://cheerio.js.org/',
doc_label: 'Cheerio Documentation',
},
{
name: 'crawlee',
label: 'Crawlee',
icon: ['svg', 'crawlee'],
cmd: 'node main.js',
doc_url: 'https://crawlee.dev/',
doc_label: 'Crawlee Documentation',
},
],
},
Expand All @@ -92,24 +119,43 @@ export const getSpiderTemplateGroups = (): SpiderTemplateGroup[] => {
doc_label: 'Go Colly Documentation',
},
{
name: 'go',
label: 'Basic Go',
name: 'goquery',
label: 'GoQuery',
icon: ['svg', 'go'],
cmd: 'go run main.go',
doc_url: `https://go.dev/`,
doc_label: 'Go Documentation',
doc_url: 'https://github.com/PuerkitoBio/goquery',
doc_label: 'GoQuery Documentation',
},
],
},
{
lang: 'java',
label: 'Java',
icon: ['fab', 'java'],
templates: [
{
name: 'java',
label: 'Basic Java',
name: 'jsoup',
label: 'Jsoup',
icon: ['fab', 'java'],
cmd: 'mvn clean compile exec:java',
doc_url: 'https://jsoup.org/',
doc_label: 'Jsoup Documentation',
},
{
name: 'webmagic',
label: 'Web Magic',
icon: ['svg', 'webmagic'],
cmd: 'mvn clean compile exec:java',
doc_url: `https://webmagic.io/docs/${locale}`,
doc_label: 'Web Magic Documentation',
},
{
name: 'xxl-crawler',
label: 'XXL-Crawler',
icon: ['svg', 'xxl'],
cmd: 'mvn clean compile exec:java',
doc_url: 'https://www.xuxueli.com/xxl-crawler/',
doc_label: 'XXL-Crawler Documentation',
},
],
},
Expand Down

0 comments on commit a79f856

Please sign in to comment.