Skip to content

Commit

Permalink
A docker image for controlling the bing scraper. (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: UltralyticsAssistant <[email protected]>
  • Loading branch information
SaitamaTechno and UltralyticsAssistant authored Apr 28, 2024
1 parent fe3817f commit f751068
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ Welcome to the Bing image scraping tool, updated and maintained by Ultralytics.

[![Ultralytics Actions](https://github.com/ultralytics/google-images-download/actions/workflows/format.yml/badge.svg)](https://github.com/ultralytics/google-images-download/actions/workflows/format.yml)

## 🐳 Docker Run

For details, visit docker github repository: <a href="https://github.com/SaitamaTechno/google-images-download-by-docker">google-images-download-by-docker</a><br>

```bash
$ docker run -d -p 80:80 --name image_searcher saitamatechno/google_images_download:v1.0
```

## 📋 Requirements

To use this software, ensure you have Python 3.8 or later and all the necessary dependencies installed. Dependencies can be installed by running the following command in your terminal:
Expand Down
12 changes: 6 additions & 6 deletions bing_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ def __init__(self):
def download_page(self, url):
try:
headers = {}
headers[
"User-Agent"
] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
headers["User-Agent"] = (
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
)
req = urllib.request.Request(url, headers=headers)
resp = urllib.request.urlopen(req)
respData = str(resp.read())
Expand Down Expand Up @@ -564,9 +564,9 @@ def similar_images(self, similar_images):
try:
searchUrl = "https://www.google.com/searchbyimage?site=search&sa=X&image_url=" + similar_images
headers = {}
headers[
"User-Agent"
] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
headers["User-Agent"] = (
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
)

req1 = urllib.request.Request(searchUrl, headers=headers)
resp1 = urllib.request.urlopen(req1)
Expand Down

0 comments on commit f751068

Please sign in to comment.