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

本站现有博文332篇,共被浏览875585

本站已经建立2583天!

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