day3爬虫初认识

    今天我们老师教了我们爬虫,一开始啥都不知道,后来老师就给我们举了一些例子,比如抢票系统,就是爬虫,感觉很有意思,上课也在努力地让自己去听让自己能懂得更多。但是越到后面越浑,越听越晕,像我这种没什么基础的也是很头痛的,只能课下努力了。

     下午也是介绍了更多的爬虫技巧,还是得多打啊哈哈哈。。。。。。

      第一段就是老师教的我们如何得到视屏也很方便。不过遇到加密的就没得办法了。

#输出成串地址
import requests
import re
response= requests.get('https://www.pearvideo.com/')
# print(response.text)
res_list = re.findall('<a href="video_(.*?)"', response.text, re.S)
print(res_list)


for v_id in res_list:
    detail_url = 'https://www.pearvideo.com/video_'+ v_id
    print(detail_url)
    
# import requests
# # response = requests.get('https://www.baidu.com/')
# # print(response.text)
# # with open('baidu.html', 'w', endcoding='utf-8') as f:
# #     f.write(response.text)
# response=requests.get("https://video.pearvideo.com/mp4/adshort/20190626/cont-1570535-14059324_adpkg-ad_hd.mp4")
# print(response.content)
# with open('王健林2.mp4', 'wb') as b:
#     b.write(response.content)
# import requests
# video_url='https://video.pearvideo.com/mp4/adshort/20190626/cont-1570535-14059324_adpkg-ad_hd.mp4'
# response=requests.get(video_url)
# print(response.text)
# with open('ajdrejs.mp4', 'wb') as g:
#     g.write(response.content)

猜你喜欢

转载自www.cnblogs.com/ysken-en/p/11093840.html