最新知识

爬取youtube评论(YouTube爬墙)

最新知识客服VX(coolfensi)2023-02-04 10:55:17385

python 爬取youtube视频

from pytube import YouTube

联系方式:微信:coolfensi
(使用浏览器扫码进入在线客服窗口)
复制联系方式

local_dir='d:/youtube'

url = ' '

result = YouTube(url)

print(url + ' ' + result.title)

result.streams.get_by_itag(137).download(local_dir)

print('done video')

youtube评论怎么复制

1、长按需要复制的部分,选中后在弹出的菜单中选择复制。

2、在评论输入框中长按,选择弹出的粘贴命令就行了。

油管怎么看评论

评论上面有一行字写着公开发表评论,点那行字就行了。

油管指国外知名视频网站youtube,网络名词。

本叫youtube,因为在国内属于封禁状态,为了能正常表达意思又能够发贴不影响,网友给他取了个名词叫油管。

观看YouTube影片的用户在其个人电脑网页浏览器上,需要安装ADOBE FLASH PLAYER的插件。其中ADOBE FLASH PLAYER是一种多见的安装在个人电脑的插件,并支持近75%的网络影片。

爬取youtube评论(YouTube爬墙) 第1张

在油管评论有危险吗

国内属于封禁状态。

在国内看油管对此没有明文规定,也不会触犯刑事法律。如果是通过正常渠道去浏览是不犯法的,但是如果你利用上外国网站从事违法犯罪活动,同时如果复制扩散有违法内容的帖子,一旦被查获,将承担相应的法律责任。

Hive实战之Youtube数据集

本次实战的数据来自于"YouTube视频统计与社交网络"的数据集,是西蒙弗雷泽大学计算机学院在2008年所爬取的数据

数据集地址

数据之间采用"\t"作为分隔符

具体数据如下:

数据量大小为1G,条数为500万+

使用环境为

hive-1.1.0-cdh5.4.5

hadoop-2.6.0-cdh5.4.5

演示形式为使用hive shell

我们一起来看看数据

主要的问题在于category和relatedIDs处理,由于Hive是支持array格式的,所以我们想到的是使用array来存储category和relatedIDs,但是我们发现category的分割符是""而realatedIDs的分隔符是"\t",我们在创建表格的时候能够指定array的分隔符,但是只能指定一个,所以再将数据导入到Hive表格之前我们需要对数据进行一定转换和清洗

并且数据中肯定会存在一些不完整数据和一些奇怪的格式,所以数据的清洗是必要的,我在这里所使用的数据清洗方式是使用Spark进行清洗,也可以使用自定义UDF函数来进行清洗

数据清洗注意点

1)我们可以看到每行数据以"\t"作为分隔符,每行有十列数据,最后一列关联ID可以为空,那么我们对数据进行split之后数组的大小要大于8

2)数据中存在 "uNiKXDA8eyQ KRQE 1035 News amp; Politics 107" 这样格式的数据,所以在处理category时需要注意 News Politics中间的 amp;

处理后的数据如下:

下面的实战都是基于数据清洗后的数据进行的

1)youtube1的创建,文件格式为textfile

create table youtube1(videoId string, uploader string, age int, category arraystring, length int, views int, rate float, ratings int, comments int,relatedId arraystring)

row format delimited

fields terminated by "\t"

collection items terminated by ""

stored as textfile;

2)youtube2的创建,文件格式为orc

create table youtube2(videoId string, uploader string, age int, category arraystring, length int, views int, rate float, ratings int, comments int,relatedId arraystring)

row format delimited

fields terminated by "\t"

collection items terminated by ""

stored as orc;

3)youtube3的创建,文件格式为orc,进行桶分区

create table youtube3(videoId string, uploader string, age int, category arraystring, length int, views int, rate float, ratings int, comments int,relatedId arraystring)

clustered by (uploader) into 8 buckets

row format delimited

fields terminated by "\t"

collection items terminated by ""

stored as orc;

数据导入:

1)load data inpath "path" into table youtube1;

2)由于无法将textfile格式的数据导入到orc格式的表格,所以数据需要从youtube1导入到youtube2和youtube3:

insert into table youtube2 select * from youtube1;

insert into table youtube3 select * from youtube1;

1)user_tmp的创建,文件格式textfile,24buckets

create table user_tmp(uploader string,videos int,friends int)

clustered by (uploader) into 24 buckets

row format delimited

fields terminated by "\t"

stored as textfile;

2)user的创建,文件格式orc,24buckets

create table user(uploader string,videos int,friends int)

clustered by (uploader) into 24 buckets

row format delimited

fields terminated by "\t"

stored as orc;

user表的数据导入也是同理

数据导入:

1)load data inpath "path" into table user_tmp;

2)由于无法将textfile格式的数据导入到orc格式的表格,所以数据需要从user_tmp导入到user:

insert into table user select * from user_tmp;

1)统计出观看数最多的10个视频

2)统计出视频类别热度的前10个类型

3)统计出视频观看数最高的50个视频的所属类别

4)统计出观看数最多的前N个视频所关联的视频的所属类别排行

5)筛选出每个类别中热度最高的前10个视频

6)筛选出每个类别中评分最高的前10个视频

7)找出用户中上传视频最多的10个用户的所有视频

8)筛选出每个类别中观看数Top10

select * from youtube3 order by views desc limit 10;

结果如下:

select tagId, count(a.videoid) as sum from (select videoid,tagId from youtube3 lateral view explode(category) catetory as tagId) a group by a.tagId order by sum desc limit 10;

结果:

select tagId, count(a.videoid) as sum from (select videoid,tagId from (select * from youtube3 order by views desc limit 20) e lateral view explode(category) catetory as tagId) a group by a.tagId order by sum desc;

结果:

思路:

结果:

思路:

结果如下:

select * from youtube_category where categoryId="Music" order by ratings desc limit 10;

结果如下:

思路:

结果如下:

油管怎么复制评论

方法/步骤

4/13 分步阅读

步骤1:创建采集任务

1)进入主界面,选择“自定义模式”

2/13

2)将商品信息页的网址复制粘贴到网站输入框中,点击“保存网址”

3/13

步骤2:创建翻页循环

1)将页面下拉到底部,点击“下一页”按钮,在右侧的操作提示框中,

选择“循环点击下一页”

4/13

步骤3:创建列表循环

1)移动鼠标,选中页面里的第一个产品链接。选中后,系统会自动识别页面里的其他相似链接。在右侧操作提示框中,选择“选中全部”

上一篇:tiktok计数单位(tiktok里面的单位k和m)

下一篇:为什么facebook上传的视频很模糊(facebook视频上传为什么不清楚)

猜你喜欢