Back
-
[Python] BeautifulSoupBack/Python 2023. 4. 19. 17:40
BeautifulSoup 마크업언어(HTML,XML) 문서를 파싱하고 검색할 수 있는 라이브러리 간단하고 쉬운 인터페이스를 제공한다 파이썬으로 구현되어 있다 파이썬 표준 라이브러리인 html.parser 와 다른 파서를 지원한다 (lxml , html5lib) BeautifulSoup 와 유사한 라이브러리 lxml - C로 구현된 파서로 빠르고 메모리 효율이 좋다 - 복잡하고 덜 직관적인 인터페이스를 제공 - 크롤링 프레임워크인 Scrapy에 내장되어 있다 html5lib - 파이썬으로 구현된 파서, 다른 파서에 비해 느리다 - HTML 파싱에 특화되어 있다 # cli> pip install beautifulsoup4 from bs4 import BeautifulSoup soup = BeautifulSo..
-
[Python] seleniumBack/Python 2022. 12. 21. 22:17
Selenium 웹 브라우저 자동화 라이브러리, 브라우저 동작을 자동화하여 웹 페이지를 테스트하거나 스크래핑 할 수 있다 다양한 언어를 지원한다 (Java, C #, Python, Ruby, JavaScript, PHP) 다양한 브라우저에서 작동할 수 있다 (Firefox, Chrome, IE, Edge) 브라우저 별 WebDriver 와 통신하여 브라우저를 제어해 비교적 느리다 Selenium 와 유사한 라이브러리 puppeteer - 구글에서 만든 웹 브라우저(Chromium) 자동화 도구 - 브라우저에서 코드를 직접 수행하여 빠르다 - Node.js 만 지원한다 playwright - MS에서 만든 웹 브라우저 자동화 도구 - 멀티 프로세스 아키텍쳐로 구현되어 병렬작업이 가능하다 - 비동기 API를..
-
[Python] requestsBack/Python 2022. 12. 20. 22:18
requests HTTP Client 라이브러리, http 요청을 보내고 응답을 처리할 수 있다 urllib3 기반으로 만들어졌다 HTTP/1.0 만 지원한다 동기적인 요청만 처리 가능하다 requests 와 유사한 라이브러리 urllib3 - 파이썬에 내장된 HTTP client 라이브러리 - HTTP/1.0 , HTTP/2.0을 지원한다 - 복잡하고 덜 직관적인 API를 제공한다 aiohttp - asyncio 을 사용해 비동기적으로 HTTP 요청을 처리하는 라이브러리 - (asyncio : 비동기식 I/O 및 이벤트 루프를 지원하는 라이브러리) selenium 브라우저를 제어하여 웹 페이지를 테스트/스크래핑 할 수 있는 라이브러리 # cli> pip install requests import req..
-
[NodeJs] playwright exampleBack/NodeJS 2022. 12. 17. 19:55
* playwright : headless 브라우저를 지원하는 라이브러리 - chromium 을 통하여 http://httpbin.org/anything 접속한다. const playwright = require("playwright"); (async () => { const browser = await playwright.chromium.launch(); const context = await browser.newContext(); const page = await context.newPage(); await page.goto('http://httpbin.org/anything'); console.log(await page.locator('pre').textContent()); await browser..
-
[NodeJS] cheerio debugBack/NodeJS 2022. 12. 15. 22:49
const cheerio = require("cheerio"); const $ = cheerio.load(pageHTML.data); function initialize(selector, context, root, opts) { html = function html(dom, options) { xml = function xml(dom) { text = function text(elements) { parseHTML = function parseHTML(data, context, keepScripts) { root = function root() { contains = function contains(container, contained) { merge = function merge(arr1, arr2) ..
-
[NodeJs] axios responseBack/NodeJS 2022. 12. 15. 22:32
- axios 를 사용하여 HTTP 요청하기 - axios : promise-based JavaScript HTTP client. const axios = require("axios"); const pageHTML = await axios.get("https://scrapeme.live/shop"); { "status": 200, "statusText": "OK", "headers": { "date": "Thu, 15 Dec 2022 13:19:12 GMT", "server": "Apache/2.4.41 (Ubuntu)", "expires": "Thu, 19 Nov 1981 08:52:00 GMT", "cache-control": "no-store, no-cache, must-revalidate", "..
-
[NodeJS] SyntaxError: await is only valid in async functions and the top level bodies of modulesBack/NodeJS 2022. 12. 15. 22:18
# const pageHTML = await axios.get("https://scrapeme.live/shop"); ^^^^^ SyntaxError: await is only valid in async functions and the top level bodies of modules at Object.compileFunction (node:vm:360:18) at wrapSafe (node:internal/modules/cjs/loader:1088:15) at Module._compile (node:internal/modules/cjs/loader:1123:27) at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) at Module..
-
[Error] pg_config executable not found.Back/Python 2022. 10. 5. 16:59
배경 redshift 실습을 위해 psycopg2 모듈을 커맨드로 설치하던 중 발생 pip install psycopg2 Collecting psycopg2 Downloading psycopg2-2.9.3.tar.gz (380 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 380.6/380.6 kB 6.7 MB/s eta 0:00:00 Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [20 lines of output] running egg_info crea..