Code Monkey home page Code Monkey logo

webscraper's Introduction

Web Scraper

Scrape the webpage, convert it into Markdown, and enhance AI search applications.

Running

To run this project, you need to create a config/dev.yaml configuration file. You can copy a template from config/temp.yaml.

Then, use the following command to run the project directly on your local machine, requiring Chrome to be installed:

make dev

Open the following URL in the browser:

http://127.0.0.1:4090?u=https://github.com/zzzgydi/webscraper

use HTTP GET mode:

http://127.0.0.1:4090?u=https://github.com/zzzgydi/webscraper&headless=false

use HTTP GET mode and disable readability:

http://127.0.0.1:4090?u=https://github.com/zzzgydi/webscraper&headless=false&readability=false

OR you can use it with curl:

POST /v1/scrape

Scrapes the webpage and returns the result in Markdown format.

Request Body

Parameter Type Description
url_list array List of URLs to scrape
headless boolean (Optional) Whether to run in headless mode
readability boolean (Optional) Whether to enhance readability of HTML

Example Request:

curl -X POST -H "Content-Type: application/json" \
     -d '{"url_list":["https://google.com"], "headless": false, "readability": false}' \
     http://127.0.0.1:4090/v1/scrape

This will start the server and output logs to the output/log directory.

Deployment

Create a config/prod.yaml file and set Chrome's remote_url to ws://chromedp:9222 if you run the following command:

docker compose up

Contributions

Any form of contribution is welcome. If you have any questions or suggestions, please create an issue.

Acknowledgments

  • github.com/chromedp/chromedp
  • github.com/PuerkitoBio/goquery
  • github.com/JohannesKaufmann/html-to-markdown
  • and so on...

License

This project is released under the MIT license. For details, please see the LICENSE file.

webscraper's People

Contributors

zzzgydi avatar hildam avatar

Stargazers

feiandxs avatar Ye Xiancai avatar Markus Rauhalahti avatar  avatar 无重力广场 avatar Masa Cento avatar  avatar linqiang avatar Nikita Zhenev avatar wjx0820 avatar  avatar Benjamin Franklin avatar 小李不在_ avatar Y!an avatar Navinda Dissanayake avatar Ishan Marikar avatar Stepan Kartavykh avatar . avatar Jimmie Lee avatar alleniver avatar  avatar Marcos Issler avatar Wenqing avatar Xutao avatar linweisong avatar  avatar  avatar 张旭红 (karminski-牙医) avatar  avatar freil avatar mapix avatar Zhi-guo Huang avatar  avatar  avatar deeprAIse avatar  avatar  avatar Jack Zhou avatar  avatar Milo avatar Latin avatar  avatar Brad Lee avatar  avatar Arbal avatar Qetesh avatar CC avatar Rodolfo Rodriguez Girbes avatar Оджасви К. Мишра avatar  avatar Zhou Tuo avatar CHurricane avatar  avatar  avatar Jeff Carpenter avatar aliazad avatar Kevin avatar  avatar  avatar  avatar ᴍᴏᴏɴD4ʀᴋ avatar zhaodongsheng avatar  avatar Yulong Wang avatar Eris2025 avatar  avatar effarig93 avatar niliy01 avatar 6david9 avatar r00tuser avatar RoCry avatar 段清华DEAN avatar  avatar satwik kumar avatar Dawei avatar  avatar  avatar Howard avatar jiandong avatar  avatar SuperZer avatar 张大千 avatar Ziyang Hu avatar luyizhou avatar 爱可可-爱生活 avatar intflag avatar yakirChen avatar  avatar Danny M avatar  avatar Zelma Treutel avatar mornlee avatar Xiang Shi avatar Jcoder avatar Christofer Sjögren avatar  avatar  avatar  avatar nash_su avatar YIFAN LI avatar

Watchers

Chuck Lien avatar  avatar  avatar  avatar

webscraper's Issues

关于 ContentFilter 字符串处理的性能问题疑惑

service/scrape/filter.go

// ContentFilter 移除违规词
func (f *Filter) ContentFilter(content string) string {
	for _, b := range f.blockString {
		if b != "" {
			content = strings.Replace(content, b, "", -1)
		}
	}

	return content
}

在违禁词去除上,源代码使用的是逐个遍历去除的逻辑。我的疑惑是如果面对一些很多内容的网页,这样的处理是否会存在性能问题呢?
是否有更好的字符串去除的方法?

Ubuntu Docker build failed

Problems

我在自己的Ubuntu上执行 sudo docker-compose up ,出现了以下问题:

0.433 go mod download: gopkg.in/[email protected]: Get "https://mirrors.aliyun.com/goproxy/gopkg.in/yaml.v3/@v/v3.0.1.info": dial tcp: lookup mirrors.aliyun.com on 100.100.2.138:53: dial udp 100.100.2.138:53: socket: permission denied
------
Dockerfile:13
--------------------
  11 |     # RUN go env -w GOPROXY=https://goproxy.cn,direct
  12 |     RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
  13 | >>> RUN go mod download
  14 |     COPY . .
  15 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c go mod download" did not complete successfully: exit code: 1
ERROR: Service 'webscraper' failed to build : Build failed

我尝试换为阿里源也是出现这种情况。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.