二叉树的博客

爬虫流程及方法08(BeautifulSoup实例)(非ajax请求)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import requests
from bs4 import BeautifulSoup


a = True
while a:
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
    }
    params = {
        '_v': '5.12.0'
    }
    fp = open('./萌新论坛爬虫.text', 'w', encoding='utf-8')
    urls = 'http://www.lolichan.vip/'
    response = requests.get(url=urls, params=params, headers=headers).text
    soup = BeautifulSoup(response, 'lxml')
    class_list= soup.select('.node-title')
    for li in class_list:
        try:
            detail_url = 'http://www.lolichan.vip/' + li.a['href']
            detail_page_text = requests.get(url=detail_url, params=params, headers=headers).text
            detail_soup = BeautifulSoup(detail_page_text, 'lxml')
            page_list = detail_soup.select('.structItem-title')
            print('抓取页面成功')
        except:
            page_list = '-----'
        for i in page_list:
            try:
                page_title = i.a.string
                page_url = 'http://www.lolichan.vip/' + i.a['href']
                page_text = requests.get(url=page_url, headers=headers).text
                detail_soup = BeautifulSoup(page_text, 'lxml')
                div_tag = detail_soup.find('div', class_='bbWrapper')
                content = div_tag.text
                fp.write(page_title + ':' + content + '\n')
                print('爬取页面成功')
            except:
                continue
    a = False

ajax请求请参考爬虫流程及方法09(动态加载页面)(ajax请求)(Json实例)

百度云盘加速

个人收集,网站有可能不安全

建议浏览器隐私模式下使用,避免用户信息被盗窃

该页面下载共享提取码:

1
QLHL

该页面解析地址由个人收集,替代网页插件版的直链解析,原理是pandownload的网页版,需要百度云盘的文件共享链接。

hugo博客部署码云

本地搭建博客

创建新文章 hugo new 你的文档名/你的文章名.md

在码云中创建库

1.链接一定是:/(填你的用户名) 2.选择公开/私有都行 3.注意不要初始化库(三个选项都不要选) 4.创建库 5.复制库链接(https类型)

深度学习之神经网络

教计算机识别手写数字

(转载自YouTube)

人工神经网络是在现代神经科学的基础上提出和发展起来的,旨在反映人脑结构及功能的一种抽象数学模型。自1943 年美国心理学家 W. McCulloch 和数学家 W. Pitts 提 出形式神经元的抽象数学模型—MP 模型以来,人工神经网络理论技术经过了 50 多年 曲折的发展。特别是 20 世纪 80 年代,人工神经网络的研究取得了重大进展,有关的理论和方法已经发展成一门界于物理学、数学、计算机科学和神经生物学之间的交叉学科。希望阅读本篇,能使你对神经网络有一个大概的了解,明白其大概的工作原理。