1 Star 0 Fork 1

quyihuang/爬虫_下载高清图片

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
html_parse.py 834 Bytes
一键复制 编辑 原始数据 按行查看 历史
quyihuang 提交于 2019-02-01 23:55 . python 源码
#! /usr/bin/env python3
# coding=utf-8
from bs4 import BeautifulSoup
import re
class Parse():
# new_urls, new_data = self.parse.Parser(new_url, html)
def Parser(self, new_url, html):
soup = BeautifulSoup(html, "html.parser", from_encoding="utf-8")
new_urls = self._get_new_urls(soup)
#new_data = self._get_new_data(new_url, soup)
return new_urls
def _get_new_urls(self, soup):
new_urls = set()
links = soup.find_all("span", class_="plid")
for link in links:
new_urls.add(((link.get_text()).split())[1])
return new_urls
def Parser2(self, url, html):
soup = BeautifulSoup(html, "html.parser", from_encoding="utf-8")
new_url = self._get_new_urls2(soup)
return new_url
def _get_new_urls2(self, soup):
link = soup.find("a", class_ = "original-file-changed", id = "highres")
return link["href"]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/quyihuang/crawler_download_hd_pictures.git
git@gitee.com:quyihuang/crawler_download_hd_pictures.git
quyihuang
crawler_download_hd_pictures
爬虫_下载高清图片
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385