#!/usr/bin/python
# -*- coding: UTF-8 -*-
import urllib.request
import urllib.error
import re
from lxml import etree
import time
import pandas as pd
import sys
import jieba
import numpy #numpy计算包
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['figure.figsize'] = (10.0, 5.0)
from wordcloud import WordCloud#词云包
headers=("user-agent","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.221 Safari/537.36 SE 2.X MetaSr 1.0")
opener = urllib.request.build_opener()
opener.addheaders = [headers]
urllib.request.install_opener(opener)
comments = ''
try:
for i in range(14,100):#因第13页存在乱码,暂无法解决,仅爬取前14页-100页
url="https://p.comments.youku.com/ycp/comment/pc/commentList?jsoncallback=n_commentList&app=100-DDwODVkv&objectId=915073585&objectType=1&listType=0¤tPage="&
镇魂优酷视频短评爬虫
最新推荐文章于 2020-12-30 07:26:38 发布