-
Notifications
You must be signed in to change notification settings - Fork 67
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
Showing
3 changed files
with
15 additions
and
6 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
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,13 +1,18 @@ | ||
from typing import List, Iterable | ||
|
||
from src.entity.proxy_entity import ProxyEntity | ||
|
||
|
||
class AbsSpider(object): | ||
|
||
def __init__(self, name='unknown') -> None: | ||
self._name = name | ||
|
||
def crawl(self): | ||
print('开始爬取...') | ||
print(f'{self._name}开始爬取...') | ||
res = self.do_crawl() | ||
print(f'爬取完毕!共:{len(res)}个代理') | ||
print(f'{self._name}爬取完毕!共:{len(res)}个代理') | ||
return res | ||
|
||
def do_crawl(self): | ||
def do_crawl(self) -> List[ProxyEntity]: | ||
raise RuntimeError('do_crawl方法没有实现!') |
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