Target: gaixinhchonloc.com
Thư viện: bs4, requests
Source code :
Đây là chương trình đơn giản chỉ có thể crawl những ảnh được load khi load trang xong :((
Hướng dẫn :
https://sgorki.me/crawl-anh-su-dung-requests-va-beautifulsoup/
Thư viện: bs4, requests
Source code :
Python:
import requests
from bs4 import BeautifulSoup
r = requests.get("https://gaixinhchonloc.com/")
content = BeautifulSoup(r.text, "html.parser")
targetContent = content.find_all("div","gridphoto")
for item in targetContent:
imgLink = item["data-photo-high"]
fileName = imgLink.split('/')[-1]
img = requests.get(imgLink, stream=True).content
open(fileName, "wb").write(img)
Hướng dẫn :
https://sgorki.me/crawl-anh-su-dung-requests-va-beautifulsoup/