如何将YouTube的“喜欢和不喜欢”以及比率从YouTube导入到Google表格中?

时间:2019-03-08 09:35:34

标签: google-sheets google-sheets-importxml

我如何将视频中的YouTube喜欢和不喜欢的内容导入Google表格?

1 个答案:

答案 0 :(得分:0)

标题:

=IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","//*[@id='eow-title']")

观看次数:

=VALUE(REGEXREPLACE(TEXT(IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo",
 "//*[contains(@class, 'watch-view-count')]"),0)," view(s)?",""))

持续时间:

=SUBSTITUTE(REGEXREPLACE(IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","//*[@itemprop='duration']/@content"),"PT|S",""),"M",":")

赞:

=IF(ISNA(IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","(//*[contains(@class,'like-button-renderer-like-button')])[1]"))=TRUE,0,
         IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","(//*[contains(@class,'like-button-renderer-like-button')])[1]"))

DISLIKES:

=IF(ISNA(IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","(//*[contains(@class,'like-button-renderer-dislike-button')])[1]"))=TRUE,0,
         IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","(//*[contains(@class,'like-button-renderer-dislike-button')])[1]"))

已上传:

=REGEXREPLACE(IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo",
 "//*[contains(@class, 'watch-time-text')]"),"((Uploaded)|(Published)|(Streamed live)) on ","")

订阅:

=IFERROR(MID(QUERY(IMPORTXML("https://www.youtube.com/channel/"&A1,
 "//div[@class='primary-header-actions']"), "select Col1"), 31, 20), )

6

频道名称:

=INDEX(IMPORTHTML("https://www.youtube.com/channel/UC7_gcs09iThXybpVgjHZ_7g","list",1),1,1)

频道ID:

=ARRAYFORMULA(REGEXREPLACE(QUERY(SUBSTITUTE(ARRAY_CONSTRAIN(
 IMPORTDATA(https://www.youtube.com/watch?v=rckrnYw5sOA), 3000, 1), """", ""),
 "where Col1 contains '<meta itemprop=channelId content='"),
 "<meta itemprop=channelId content=|>", ""))