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

本站现有博文328篇,共被浏览837663

本站已经建立2541天!

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