The simple crawler about algorithm problem service website
Project description
๐ฆ psdelivery
pip install psdelivery
Introduction
์ฌ๋ฌ ์ฝ๋ฉ ์ฌ์ดํธ์ ์ฝ๋ฉ ๋ฌธ์ ๋ค์ ํฌ๋กค๋งํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ๋๋ค. ์ด๊ธฐ ๋ฒ์ ์ด๋ผ ๊ธฐ๋ณธ ์์ค์ ๊ธฐ๋ฅ๋ง ์ง์ํ์ง๋ง. ์ฐจํ ๋ ๋ง์ ๊ธฐ๋ฅ๋ค์ ์ถ๊ฐํ ์์ ์ ๋๋ค. ์๋๋ฉด ์ฌ๊ฐ ์ ๋ฉ์ธ ํ๋ก์ ํธ์ ์ธ ๊ฑฐ๋๊น์.
๐โโ๏ธ Functions
Implemented
- ํด๋น ์ฌ์ดํธ์์ ์ฝ๋ฉ๋ฌธ์ ๋ฅผ ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค.
- ๋ฐฑ์ค (solved.ac)
- ๋ฆฌํธ์ฝ๋ (leetcode)
- ํ์ด์ฌ ํ๋ก์ ํธ์ ๋ชจ๋๋ก ์ฌ์ฉํ ์ ์๊ณ , CLI ํ๊ฒฝ์์๋ ๋ฐ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค.
- CLI ํ๊ฒฝํด์ ๋ช ๋ น์ด๋ฅผ ํตํด ์คํํ ๊ฒฝ์ฐ, ๊ฒฐ๊ณผ ๋ฐ์ดํฐ๋ JSON์ผ๋ก ์ ์ฅ๋ฉ๋๋ค.
Will be Implemented
- ํด๋น ์ฌ์ดํธ์๋ ์ฝ๋ฉ๋ฌธ์ ๋ฅผ ๊ฐ์ ธ์ฌ ์์ ์
๋๋ค.
- ์ฝ๋ํฌ์ค (codeforces)
- ํด์ปค๋ญํฌ (hackerrank)
- ์ฌ๋ฌ ํ์ด์ง ๋ฒ์์ ๋ฌธ์ ๋ฆฌ์คํธ๋ฅผ ๋ฝ์์ฌ ์ ์์ต๋๋ค.
- ํด๋น ์ฌ์ดํธ์ ๋ชจ๋ ๋ฌธ์ ๋ค๋ ํ๋์ ๋ช ๋ น์ด๋ก ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค.
- ํน์ ๋ฌธ์ ์ ๋ํ ์ธ๋ถ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค.
- ์๊ณ ๋ฆฌ์ฆ ํ๊ทธ๋ฅผ ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค.
โญ Required
- ๋ฐ๋์ ํฌ๋กฌ์ด ์ค์น๋์ด ์์ด์ผ ํฉ๋๋ค.
- Debian๊ณ์ด์ ๊ฒฝ์ฐ, bin๋๋ ํ ๋ฆฌ์ ํฌ๋กฌ์ ์ค์นํ๋ Shell Script๊ฐ ์์ต๋๋ค.
- ํ์ด์ฌ ๋ฒ์ ์ ๋ฐ๋์
3.10์ด์์ด์ด์ผ ํฉ๋๋ค.
๐ฝ How To Install For Developer
ํฌ๋กฌ๊ณผ ํ์ด์ฌ์ด ์ค์น๋์ด์๋ค๋ ๊ฐ์ ํ์ ์ค๋ช ํฉ๋๋ค.
- requirements.txt๋ฅผ ํตํด ํจํค์ง๋ฅผ ์ค์นํฉ๋๋ค.
- ๋
Usage
As Command Line
โ๏ธ Version ํ์ธํ๊ธฐ
python -m psdelivery version
# 0.1.0
๐ ๋ฌธ์ ๋ฆฌ์คํธ ๊ฐ์ ธ์ค๊ธฐ
python -m psdelivery getlist -t <topic> -sp <page index> -o <output json file>
- Options
- -t(--topic): ์ฝ๋ฉ ํ์ด์ง ์ฌ์ดํธ๋ฅผ ๋ช
์ํฉ๋๋ค. ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง๊ณ ์ฌ ์ ์๋ ์ฌ์ดํธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
- ๋ฐฑ์ค:
baekjoon๋๋solved.ac - ๋ฆฌํธ์ฝ๋:
leetcode
- ๋ฐฑ์ค:
- -sp(--single-page): ํ์ด์ง ์ธ๋ฑ์ค๋ฅผ ๋ํ๋ ๋๋ค. ํด๋น ์ต์ ์ ๋ช ์ํ์ง ์์ผ๋ฉด 1ํ์ด์ง์ ๋ฌธ์ ๋ฆฌ์คํธ๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
- -o(--output): ์ฝ๋ฉ๋ฌธ์ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ ํ์ผ ๋ฃจํธ๋ฅผ ๋ช ์ํฉ๋๋ค.
- -t(--topic): ์ฝ๋ฉ ํ์ด์ง ์ฌ์ดํธ๋ฅผ ๋ช
์ํฉ๋๋ค. ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง๊ณ ์ฌ ์ ์๋ ์ฌ์ดํธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
- example
python -m psdelivery getlist -t baekjoon -sp 3 -o output.json
As Python Module
from psdelivery import PsDelivery
"""
PsDelivery ๊ฐ์ฒด ์์ฑ
topic์ ํฌ๋กค๋งํ ์ฌ์ดํธ ์ด๋ฆ์ ์
๋ ฅํฉ๋๋ค.
๋ฐฑ์ค: baekjoon ๋๋ solved.ac
๋ฆฌํธ์ฝ๋: leetcode
"""
crawler = PsDelivery(topic='leetcode')
"""
ํน์ ํ์ด์ง์ ๋ฌธ์ ๋ฆฌ์คํธ๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
page:
๊ฐ์ ธ์ฌ ํ์ด์ง ์ชฝ์๋ฅผ ์
๋ ฅํฉ๋๋ค. ๋ฐ๋์ 1 ์ด์์ด์ด์ผ ํฉ๋๋ค.
serialize:
์ผ๋ฐ์ ์ธ ๋ฆฌํด๋ ๋ฆฌ์คํธ์ ์์๋ ProblemItem์ด๋ผ๋ ๊ฐ์ฒด ์
๋๋ค.
serialize=True๋ก ์ค์ ํ๋ฉด ProblemItem์ Dict ํํ๋ก ์ง๋ ฌํ ํฉ๋๋ค.
Default๊ฐ์ False ์
๋๋ค.
"""
result = crwaler.get_list_by_single_page(page=1)
"""
return: [<ProbmeItem>, <ProblemItem>, ...]
"""
result_as_json = crawler.get_list_by_single_page(page=2, serialize=True)
"""
return: [<Dict>, <Dict>, ...]
"""
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
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 psdelivery-0.1.2.tar.gz.
File metadata
- Download URL: psdelivery-0.1.2.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d30a73ffa440b935cd2735a6677ab9edba6d745faa92fecb1ac0a7173b04121
|
|
| MD5 |
622656f20f93f8777d4efcfb5dc218f1
|
|
| BLAKE2b-256 |
b69d0235f6942aa61f1b80abf45fa975cc654af7a71d26bc51e770eed4d24857
|
File details
Details for the file psdelivery-0.1.2-py3-none-any.whl.
File metadata
- Download URL: psdelivery-0.1.2-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61e1f3222bebb711db48310502feb80b424742ab54ff73bbbf98aaac4d6dced7
|
|
| MD5 |
92e7ef5abb66426790dd526164512493
|
|
| BLAKE2b-256 |
e4e34f18e88ff3a2375eaa85f3d6f36a200648d57472ccfdf145a94680cdbed9
|