爬取kw音乐
headers JS逆向 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import requestssearchkey=input('请输入歌手名字:')headers={ 'Cookie': 'kw_token=HJFZGV04WSS', # 主机域名 'Host': 'www.kuwo.cn', # 认证令牌 'csrf': 'HJFZGV04WSS', # 防盗链 'Referer': 'http://www.kuwo.cn/search/list?key=%E5%91%A8%E6%9D%B0%E4%BC%A6', # 浏览器信息 'User-Agent':...
把Jupyter Notebook放到网站并嵌入
在source目录下放文件或文件夹,在hexo中需要在_config.yml中设置: 1234post_asset_folder: truemarked: prependRoot: true postAsset: true 那么,里面的东西就会放到网站中。本地的source目录就成了网站中的根目录(跟在主机名后面) 让hexo不渲染某个目录下的所有文件(在这里放Jupyter Notebook的html文件)把,在hexo中需要在_config.yml中设置 1skip_render: "Jupyter_notebook/**" 那么Jupyter Notebook的html文件就发布到网站中了 例如: 1[notebook](https://ferrychan666.github.io/Jupyter_notebook/world_colleges.html)
世界大学数据爬取+可视化
数据爬取12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970import reimport pandas as pdfrom selenium import webdriverfrom bs4 import BeautifulSoupfrom selenium.webdriver.common.by import Bydef create_web_driver(url): # 不打开浏览器的情况下,爬取数据 options=webdriver.ChromeOptions() # 无头模式 #options.add_argument('--headless') # 不加载图片 prefs = { ...
使脚本在后台运行
需要在要运行的bat文件前面加上: 123if "%1"=="hide" goto CmdBeginstart mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit:CmdBegin
中国大学数据分析
Selenium效率低的缺点,但有着可见即可爬的优点。BeautifulSoup本来是用于更快地提取html代码中的数据,效率高,但难以爬取动态网页。 所以,我想采取Selenium+BeautifulSoup的方式,高效爬取动态网页。 先selenium经一系列的操作之后,brower.page_source 获取源码 将源码传给BeautifulSoup,快速爬取 下面以中国大学项目作为实例: 12345678910create database collegesdb charset utf8;use collegesdb;create table t(ranking int,name VARCHAR(20),abroad_rate float(10,1),employment_rate float(10,1),numberOfGraduate int,numberOfUndergraduate...
love confess
I once dreamed of a princess like you being mine. Do you love me? Yessss! No! function yes(){ document.getElementById("text").innerHTML="I love you, too. Please feel free to contact me at anytime if further information is needed. My email is ferrychan666@gmail.com."; var elem = document.getElementById('no'); return elem.parentNode.removeChild(elem); } function no() { document.getElementById("text").innerHTML="I love you because I...
beautifulSoup practice
本次我采用BeautifulSoup爬取网页数据,并打印到csv文件中,相比于selenium,BeautifulSoup更加快速。 有几个值得注意的问题 编码 find()和find_all() find()返回指定元素 find_all()返回指定元素的列表 table=soup.find("tbody").find_all("tr")这里先用find()找到第一个tbody, 再用find_all()返回tbody中所有的tr元素列表。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879from bs4 import BeautifulSoupimport requestsimport rerankList =...
BeautifulSoup
IntroductionBeautiful Soup is a Python library for pulling data out of HTML and XML files. It works with your favorite parser to provide idiomatic ways of navigating. I’ll be using as an example throughout this document. 123456789101112html_doc = """<html><head><title>The Dormouse's story</title></head><body><p class="title"><b>The Dormouse's story</b></p><p class="story">Once upon...
mysql commands
Start 运行mysql程序 启动mysql8.0版本1net start mysql80 进入命令行模式 1mysql -u root -p 接下来就可以用命令操作数据库 12345678910//查看所有的数据库show databases;//改变默认数据库use database_name;//查看默认数据库中所有的表show tables;//查看某个表的结构describe table_name;//查看表中的记录select * from table_name;
