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

本站现有博文323篇,共被浏览799822

本站已经建立2499天!

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