程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

How to use Python to see the vision of goddess? How can a beautiful woman look more energetic ~ (with complete source code)

編輯:Python

well ~well ~well ~

I'm not in good spirits recently , There is always no motivation for work ~

Maybe I'm too tired at work ,

So I made myself a little thing to relax ~


what are you having? python I won't answer the related error report 、 Or source code information / Module installation / Women's clothing bosses are proficient in skills You can come here :(https://jq.qq.com/?_wv=1027&k=2Q3YTfym) perhaps +V:python10010 Ask me ( At the end of the article )

Don't talk much , Let's go straight to

[ Knowledge point ]:

python Learning exchange group :903971231###
Massive video data can be saved with one click
html Label data analysis method
re Method of parsing data

[ Introduction to the environment ]:

python 3.8
pycharm 2021.2
requests >>> pip install requests
parsel >>> pip install parsel

+python Installation package Installation tutorial video
+pycharm Community Edition pro And Activation code free


One . Analysis website ( Thought analysis )

 We do this by putting a link in front of the page + view-source:https:.....
You can view the web page source code , We can find in the web page source code Video link address

Two . Code implementation

1. Send network request
2. get data Web source code
3. Filter data Video details page address
4. Send network request
5. get data Web source code
6. Filter data Video address
7. Access the video playback address
8. Get video binary data
9. preservation Video data



The import module

import requests # Send network request 
import re # Regular modules 
import parsel # Parsing data module 

See who hasn't installed the module

1. Send network request

url_1 = 'https://www.520mmtv.com/tag/xg.html'
response_1 = requests.get(url_1)

2. get data Web source code

data_html_1 = response_1.text

3. Filter data Video details page address

selector = parsel.Selector(data_html_1)
info_url_list = selector.css('.meta-title::attr(href)').getall()
title_url_list = selector.css('.meta-title::text').getall()
new_title_list = [i for i in title_url_list if i != ' ']
# zip: We need to link the video Loop together with the title 
for zip_data in zip(info_url_list, new_title_list):
url = zip_data[0]
 # 1. Send network request 
response = requests.get(url=url)
# <Response [200]>: Send the request and respond successfully 
# 2. get data Web source code 
data_html = response.text
# 3. Filter data Video address 
# The first parameter matches the rule Second, where do we want to match 
video_url = re.findall('url: "(.*?)",', data_html)[0]
print(video_url)
# 4. Access the video playback address 
# 5. Get video / Audio / picture binary data 
video_data = requests.get(video_url).content
title = zip_data[1]
# 6. preservation Video data 
with open(f'video\\{
title}.mp4', mode='wb') as f:
f.write(video_data)
print(title, ' Climb to success !!!')

Okay , My article ends here !

There are more suggestions or questions to comment on or send me a private letter ! Come on together and work hard (ง •_•)ง

If you like, just pay attention to the blogger , Or like the collection and comment on my article !!!


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved