Skip to content

Commit

Permalink
更新标注
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvandia committed Jul 27, 2023
1 parent e3a5704 commit 019cb33
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 64 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,28 @@ _⭐基于`httpx`的为[次元小镇](https://dimtown.com)的异步爬虫⭐_

- 本项目采用 `Apache License 2.0` 开源协议。在使用这个项目之前,请确保你已经**仔细阅读并理解了协议的相关条款**。本项目**严禁**用于任何**商业用途**,并且只能用于学习和研究。如果在使用本项目的过程中产生任何问题或结果,**我们不承担任何责任**。同时,我们鼓励用户为这个项目的改进和发展提供反馈和建议。

## 🦈 安装

<details>
<summary>安装</summary>

pip 安装

`pip install dimtown-spider -U`

poetry 安装

`poetry add dimtown-spider`

</details>

## 🐟 使用

> 可见以下示例:
```python
import asyncio
from dimtown_spider import AnimeAvatar
from dimtown import AnimeAvatar

if __name__ == "__main__":
aa = AnimeAvatar()
Expand Down
3 changes: 3 additions & 0 deletions dimtown/AnimeAvatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
from bs4 import BeautifulSoup

class AnimeAvatar(Spider):
'''
`漫画头像`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "comictx"
Expand Down
4 changes: 3 additions & 1 deletion dimtown/ArtAlbum.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import asyncio

class ArtAlbum(Spider):

'''
`画册`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "tujihuace"
Expand Down
3 changes: 3 additions & 0 deletions dimtown/CoupleAvatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import asyncio

class CoupleAvatar(AnimeAvatar):
'''
`情侣头像`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "loverstx"
Expand Down
3 changes: 3 additions & 0 deletions dimtown/FemaleAvatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import asyncio

class FemaleAvatar(AnimeAvatar):
'''
`女生头像`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "lolitx"
Expand Down
3 changes: 3 additions & 0 deletions dimtown/Figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import asyncio

class Figure(Spider):
'''
`手办`图片获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "shouban"
Expand Down
3 changes: 3 additions & 0 deletions dimtown/MaleAvatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import asyncio

class MaleAvatar(AnimeAvatar):
'''
`男生头像`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "mantx"
Expand Down
4 changes: 3 additions & 1 deletion dimtown/SelectedIllustrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import asyncio

class SelectedIllustrations(Spider):

'''
`精选插画`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "jxmt"
Expand Down
4 changes: 3 additions & 1 deletion dimtown/SelectedPixiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import asyncio

class SelectedPixiv(Spider):

'''
`精选Pixiv`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "pzmt"
Expand Down
2 changes: 1 addition & 1 deletion dimtown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
__title__ = 'dimtown'
__description__ = 'A Spider for https://dimtown.com'
__url__ = 'https://github.com/Cvandia/dimtown-spider'
__version__ = '0.0.1'
__version__ = '0.0.3'
__author__ = 'Cvandia'
__author_email__ = '1141538825@qq.com'
__license__ = 'MIT License'
4 changes: 3 additions & 1 deletion dimtown/cosplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import re

class CosPlay(Spider):

'''
`CosPlay`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "cosplay"
Expand Down
3 changes: 3 additions & 0 deletions dimtown/hanfu.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from utils import Spider
import asyncio
class HanFu(Spider):
'''
`汉服`图片获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "hanfu"
Expand Down
4 changes: 3 additions & 1 deletion dimtown/jk.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import asyncio

class JK(Spider):

'''
`JK图片`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "jk"
Expand Down
4 changes: 3 additions & 1 deletion dimtown/lolita.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import asyncio

class Lolita(Spider):

'''
`Lolita图片`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "lolita"
Expand Down
104 changes: 53 additions & 51 deletions dimtown/pcpic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,57 @@
import asyncio

class PcPic(Spider):
'''
`pc壁纸`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "bz"

async def _save_html(self, file_name:str) -> bool:
'''
保存网页
参数:
- file_name: 文件名
返回:
- bool: 是否保存成功
'''
await super()._save_html(self.api_url, file_name)

async def get_pcpic_list(self, page:int = 1) -> list:
'''
获取pc壁纸列表
参数:
- page: 页数
返回:
- list: pc壁纸列表
'''
return await super().get_img_list(page)

def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "bz"

async def _save_html(self, file_name:str) -> bool:
'''
保存网页
参数:
- file_name: 文件名
返回:
- bool: 是否保存成功
'''
await super()._save_html(self.api_url, file_name)

async def get_pcpic_list(self, page:int = 1) -> list:
'''
获取pc壁纸列表
参数:
- page: 页数
返回:
- list: pc壁纸列表
'''
return await super().get_img_list(page)

async def get_pcpic_title(self, page:int = 1) -> list:
'''
获取pc壁纸标题
参数:
- page: 页数
返回:
- list: pc壁纸标题
'''
return await super().get_title_list(page)

async def get_pcpic_img(self, url:str) -> list:
'''
获取pc壁纸图片列表
参数:
- url: pc壁纸链接
返回:
- list: pc壁纸图片列表
'''
return await super().get_img_url(url)
async def get_pcpic_title(self, page:int = 1) -> list:
'''
获取pc壁纸标题
参数:
- page: 页数
返回:
- list: pc壁纸标题
'''
return await super().get_title_list(page)

async def get_pcpic_img(self, url:str) -> list:
'''
获取pc壁纸图片列表
参数:
- url: pc壁纸链接
返回:
- list: pc壁纸图片列表
'''
return await super().get_img_url(url)
4 changes: 3 additions & 1 deletion dimtown/phonepic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import re

class PhonePic(Spider):

'''
`手机壁纸`获取
'''
def __init__(self) -> None:
super().__init__()
self.api_url = self.base_url + "sjbz"
Expand Down
6 changes: 3 additions & 3 deletions dimtown/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from bs4 import BeautifulSoup

class Spider:
'''
爬虫基类
'''
def __init__(self) -> None:
'''
初始化
'''
self.base_url = "https://dimtown.com/"
self.api_url = None
self.url = None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dimtown-spider"
version = "0.0.2"
version = "0.0.3"
description = "A spider for https://dimtown.com"
authors = ["divandia <106718176+Cvandia@users.noreply.github.com>"]
readme = "README.md"
Expand Down

0 comments on commit 019cb33

Please sign in to comment.