python+selenium抓取网页新闻列表元素,保存到excel文档中

2023-10-26

python+selenium:抓取网页新闻列表元素,并记录标题和链接地址,保存到excel文档中

#!/usr/local/bin/python3
# !python3.9
# -*- coding: UTF-8 -*-
'''
@File:xwzx1.py
@Time:2021-09-09 18:32
@Author:user
抓取网页新闻列表元素,并记录标题和链接地址,保存到excel文档中
'''
from selenium import webdriver
from os.path import join
import os
import sys
from time import strftime
from time import sleep
import xlrd
import xlwt

excel_dir=os.path.dirname(os.path.abspath(__file__))
now_time=strftime("%Y-%m-%d-%H-%M")


class text_xwzx():
    def __init__(self):

        self.url="http://www.sinopecgroup.com/group/xwzx/"
        self.filename=now_time+".xls"
        self.path
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

python+selenium抓取网页新闻列表元素,保存到excel文档中 的相关文章

随机推荐