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

本站现有博文339篇,共被浏览990086次

本站已经建立2702天!

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