This is a repo of some small tools created by python.
Project description
Brief
This is a repo of some smallTools created by python.
module 1:image_spider
- This tool allow you to crawl images from
3website, which are Pixiv,Bing and Baidu.
Module:pixiv
- Make sure that your internet can visit the foreign websites.
- The module has two ways to crawl images:
Rankandkeyword.
Easy use
import ToolBoxByHanXu.image_spider.pixiv as pixiv
if __name__ == '__main__':
example=pixiv.pixiv_spider()
example()
search by Rank
- Looking at the following example:
{'1': 'Rank', '2': 'Keyword'}
Type in the target you want to search.
1
{'1': 'Simple:Recommended and Fast because the downloaded images are vague.You can view the simple image and select what you love', '2': 'Specific:Not Recommended and Slow because the downloaded images are clear'}
Type in the requirement of download-mode.
1
type in the path where you want to reserve the images:
rank20230424
Type in the number of images you want:
5
{'1': 'daily', '2': 'weekly', '3': 'monthly', '4': 'rookie', '5': 'daily_ai', '6': 'male', '7': 'female'}
type in the searchMode you want
1
Type in the date you want to search.Follow the format like this:20230423
20230424
search by keyword
{'1': 'Rank', '2': 'Keyword'}
Type in the target you want to search.
2
{'1': 'Simple:Recommended and Fast because the downloaded images are vague.You can view the simple image and select what you love', '2': 'Specific:Not Recommended and Slow because the downloaded images are clear'}
Type in the requirement of download-mode.
1
type in the path where you want to reserve the images:
秋山澪图片
Type in the number of images you want:
5
{'1': '500', '2': '1000', '3': '5000', '4': '10000'}
Type in the requirement of heat.Larger the number is,Less the results are.
2
type in the keywords used to search in pixiv:
秋山澪
Module:bing
- Use the following code to run the module.
import ToolBoxByHanXu.image_spider.bing as bing
if __name__ == '__main__':
example=bing.Spider_bing_image()
example()
type in the path where you want to reserve the images:秋山澪
type in the keywords used to search in bing:秋山澪
Type in the number of pages you want.Each page has almost 30 images:1
Module:baidu
- The package can crawl the images at baidu based on the
keywordoffered by you. - use the following code to use the package
import ToolBoxByHanXu.image_spider.baidu as baidu
if __name__ == '__main__':
example = baidu.Spider_baidu_image()
example()
type in the path where you want to reserve the images:秋山澪
type in the keywords used to search in Baidu:秋山澪
Type in the number of pages you want.Each page has 30 images:1
module 2:normalize_md
- Usually, when we write the md file, the images in the md file are bundled with the internet. If you want to view the images offline, you should download the images at advanced and modify the image-urls in the md file, which is awful and takes much time! This tool allow you to download the internal images in the md file automatically so that you could view the md file without the internet anymore!
- The algorithm is in-place!You'd better copy the md dir in advance.
import ToolBoxByHanXu.normalize_md as normal
if __name__ == '__main__':
# replace the directory you want to rename
target_directory = r"D:\Desktop\demo"
normal.normalizer(current_dir=target_directory)()
result:
- before:
- after:
module 3:rename_files
- This tool could rename all the files in a directory decided by you. You have
2choices to rename them.
rename by order
- If you don't mind the
filename extension, you could rename all of them at one time.Given New name and order key, the code will add the order automatically.
import ToolBoxByHanXu.rename_files as rename
if __name__ == '__main__':
# replace the directory you want to rename
example=rename.renamer(r"D:\Desktop\C & C++")
example(new_name="demo",order_key=lambda x: int(x[ x.rfind(".")-1 : x.rfind(".")+1] ) )
rename by filename extension
- For example, if you want to rename all the images, you may type in
jpgorpngas followed.
import ToolBoxByHanXu.rename_files as rename
if __name__ == '__main__':
# replace the directory you want to rename
example=rename.renamer(r"D:\Desktop\C & C++")
example(new_name="demo",target_type="jpg")
result:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
toolboxbyhanxu-1.0.0.tar.gz
(12.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toolboxbyhanxu-1.0.0.tar.gz.
File metadata
- Download URL: toolboxbyhanxu-1.0.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67caed53ee33e1ba8307640013b5ed4d3596c66a499a2b4af084761add5dc0e5
|
|
| MD5 |
fe4d9349f914206e1443299a0b904e5b
|
|
| BLAKE2b-256 |
9ad90c2c3675b35488cf7291da0b54147cbb5599c879af39965324def76b0514
|
File details
Details for the file ToolBoxByHanXu-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ToolBoxByHanXu-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4faebfff732b8c7fcd8a81bd1bb70a36a64766d14ffa393ce743b62d74dd6ba4
|
|
| MD5 |
65cad7c46bb910f167b2985fa31dc105
|
|
| BLAKE2b-256 |
3df4a360ebd91fe600865a7734d7bfb529873e22d6e071111eeca57f957eccb7
|