• 大小: 13KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-09
  • 语言: Python
  • 标签:

资源简介

爬取微信公众号文章

资源截图

代码片段和文件信息

from selenium import webdriver
import selenium
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from bs4 import BeautifulSoup
import requests
import logging
import re
import time
from urllib.parse import quote
import random

base_URL = ‘http://weixin.sogou.com‘

UA = “Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/39.0.2171.95 Safari/537.36“

def get_html(url):
    dcap = dict(DesiredCapabilities.PHANTOMJS)
    dcap[“phantomjs.page.settings.userAgent“] = (
        UA
    )
    dcap[“takesScreenshot“] = (False)
    #t0 = time.time()
    try:
        driver = webdriver.PhantomJS(desired_capabilities=dcap service_args=[‘--load-images=no‘])
        driver.set_page_load_timeout(240)
        driver.command_executor._commands[‘exec

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-10-01 00:34  weixin_sogou-master\
     文件         702  2015-10-01 00:34  weixin_sogou-master\.gitignore
     文件        1077  2015-10-01 00:34  weixin_sogou-master\LICENSE
     文件         970  2015-10-01 00:34  weixin_sogou-master\README.md
     目录           0  2015-10-01 00:34  weixin_sogou-master\frontend\
     文件        2030  2015-10-01 00:34  weixin_sogou-master\frontend\archive.html
     目录           0  2015-10-01 00:34  weixin_sogou-master\frontend\css\
     文件        8827  2015-10-01 00:34  weixin_sogou-master\frontend\css\circle.css
     文件        8808  2015-10-01 00:34  weixin_sogou-master\frontend\css\main.css
     文件        5021  2015-10-01 00:34  weixin_sogou-master\frontend\index.html
     目录           0  2015-10-01 00:34  weixin_sogou-master\frontend\js\
     文件        6615  2015-10-01 00:34  weixin_sogou-master\frontend\js\search.js
     文件        5775  2015-10-01 00:34  weixin_sogou-master\weixin_sogou.py

评论

共有 条评论