代码拉取完成,页面将自动刷新
#! /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"]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。