EADST

Obtain Links and Download Images from Webpages

Obtain Links and Download Images from Webpages

import requests
from bs4 import BeautifulSoup

def getHTMLText(url):
    try:
        res = requests.get(url, timeout = 6)
        res.raise_for_status()
        res.encoding = res.apparent_encoding
        return res.text
    except:
        return 'Error'

def main(url):
    demo = getHTMLText(url)
    soup = BeautifulSoup(demo, 'html.parser')
    a_labels = soup.find_all('a', attrs={'href': True})

    for idx, a in enumerate(a_labels):
        link = a.get('href')
        if "res" not in link and ".jpg" in link and idx % 50 == 1:
            urls = url + link
            save_path = "./save/" + link
            with open(save_path, 'wb') as f:
                f.write(requests.get(urls).content)


url = "http://eadst.com/"
main(url)
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
签证 BF16 Llama GIT XML Excel TSV Magnet Bipartite Bitcoin 飞书 Video Tracking WebCrawler EXCEL GGML Quantize AI 财报 Attention SVR Pillow UI 算法题 OpenCV Math logger printf PDB 论文 HaggingFace Shortcut C++ Interview PIP llama.cpp CEIR Knowledge Nginx Plotly Disk v2ray Qwen2 LoRA Paddle Bin Firewall Proxy CLAP ModelScope Domain VPN ChatGPT Breakpoint 版权 Permission Linux 腾讯云 FP32 Ubuntu 强化学习 SPIE Diagram SAM SQL Python InvalidArgumentError Django tar Distillation Land Jupyter Quantization LaTeX Gemma Conda CV torchinfo Review VGG-16 阿里云 Pandas Sklearn NLTK Freesound FP8 Animate IndexTTS2 LLAMA OCR Website PyTorch Paper Cloudreve Search CTC transformers Plate XGBoost Datetime 图标 icon Color COCO FlashAttention Hilton ms-swift 净利润 Safetensors Michelin Tensor Dataset OpenAI Random ResNet-50 Anaconda Food UNIX RAR tqdm 证件照 Vmess News 继承 Agent 域名 mmap 关于博主 Hungarian 递归学习法 uwsgi MD5 Ptyhon Zip CAM Github diffusers GoogLeNet Crawler TensorFlow FastAPI Password NLP Base64 CSV CC Jetson 多线程 Numpy Tiktoken LeetCode Card GPTQ v0.dev git TTS Heatmap PDF Streamlit BTC Qwen Image2Text Data LLM Transformers Rebuttal Mixtral Baidu BeautifulSoup 报税 WAN RL Template SQLite Claude Augmentation Windows scipy Git Pickle RGB hf git-lfs 论文速读 音频 Web 云服务器 Docker Vim 公式 Bert Statistics TensorRT Clash FP16 DeepStream 第一性原理 HuggingFace PyCharm Logo Google YOLO VSCode NameSilo Input 顶会 Markdown uWSGI CUDA 多进程 Miniforge JSON Algorithm DeepSeek GPT4 Hotel Use 搞笑 Qwen2.5 Pytorch FP64 ONNX 图形思考法 Translation API QWEN
站点统计

本站现有博文333篇,共被浏览909625

本站已经建立2612天!

热门文章
文章归档
回到顶部