Skip to main content

The simple crawler about algorithm problem service website

Project description

๐Ÿ“ฆ psdelivery

Ubuntu Windows CI GitHub PyPI - Python Version PyPI codecov

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

ํฌ๋กฌ๊ณผ ํŒŒ์ด์ฌ์ด ์„ค์น˜๋˜์–ด์žˆ๋‹ค๋Š” ๊ฐ€์ • ํ•˜์— ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

  1. requirements.txt๋ฅผ ํ†ตํ•ด ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
  2. ๋—

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): ์ฝ”๋”ฉ๋ฌธ์ œ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ํŒŒ์ผ ๋ฃจํŠธ๋ฅผ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค.
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psdelivery-0.1.2.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

psdelivery-0.1.2-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

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

Hashes for psdelivery-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7d30a73ffa440b935cd2735a6677ab9edba6d745faa92fecb1ac0a7173b04121
MD5 622656f20f93f8777d4efcfb5dc218f1
BLAKE2b-256 b69d0235f6942aa61f1b80abf45fa975cc654af7a71d26bc51e770eed4d24857

See more details on using hashes here.

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

Hashes for psdelivery-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 61e1f3222bebb711db48310502feb80b424742ab54ff73bbbf98aaac4d6dced7
MD5 92e7ef5abb66426790dd526164512493
BLAKE2b-256 e4e34f18e88ff3a2375eaa85f3d6f36a200648d57472ccfdf145a94680cdbed9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page