video_chat_get 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/site_list/mildom_analyze.rb +1 -3
- data/lib/site_list/youtubelive_analyze.rb +31 -50
- data/lib/video_chat_get/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 518a37dc694766450b8b7492ade79c354e260c9b2970fb49ad3dec3d4c060563
|
4
|
+
data.tar.gz: aa53b6f56bfc39853e8233e52ea6239a66c56c6c1a76e2585f04c099f60838ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a2eaa81eeac2250b299a62d66181f366ea5d08a581d95cfaa7ecd39157761bf45a40537559749f68a575b304dee645e5cf8b6ccc41afba1475a2a3f3711cfd9
|
7
|
+
data.tar.gz: 04e540629458d2bf3a64f388588384ea4df8db2a1a37eec28218cff65b73dd116f03e055df5e6c952b603ffa0fe0879a9b62e5b454537b7abc8ab035d316d5f8
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ require 'nokogiri'
|
|
8
8
|
|
9
9
|
class Youtubelive_analyze<Video_analyze
|
10
10
|
|
11
|
-
attr_reader :video_id
|
11
|
+
attr_reader :video_id, :videoinfo, :videoinfo_request_status
|
12
12
|
|
13
13
|
def initialize(url)
|
14
14
|
@CHAT_REQUEST_URL="https://www.youtube.com/live_chat_replay?continuation="
|
@@ -16,61 +16,26 @@ class Youtubelive_analyze |
|
16
16
|
|
17
17
|
@video_url=url
|
18
18
|
@video_id=videoid_get!(@video_url)
|
19
|
+
@videoinfo_polymer,@videoinfo_request_status=videoinfo_get(@video_url)
|
20
|
+
@videoinfo=videoinfo_extraction()
|
19
21
|
@chatlog_filepath="./"+@video_id+".txt"
|
20
22
|
end
|
21
23
|
|
22
24
|
|
23
|
-
def videoid_get!(url)
|
25
|
+
def videoid_get!(url=@video_url)
|
24
26
|
videoid=url.split("=")[1].split("&")[0]
|
25
27
|
return videoid
|
26
28
|
end
|
27
29
|
|
28
|
-
|
29
|
-
def videoinfo_get()
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
"""
|
34
|
-
chat url get from iframe
|
35
|
-
202077end
|
36
|
-
"""
|
37
|
-
def chat_url_get_iframe_extraction(url=@video_url)
|
38
|
-
|
39
|
-
next_url=""
|
40
|
-
body_status=""
|
41
|
-
iframe_count=0
|
42
|
-
opt={}
|
43
|
-
|
44
|
-
while next_url.empty?
|
45
|
-
sleep(1)
|
46
|
-
iframe_count+=1
|
47
|
-
first_respons, body_status=request_html_parse(url,opt)
|
48
|
-
first_respons.search('iframe').each do |info|
|
49
|
-
puts info
|
50
|
-
if info["src"].include?("live_chat_replay") then
|
51
|
-
next_url=info["src"]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
progressbar(iframe_count,"iframe_count_inf")
|
55
|
-
end
|
56
30
|
|
57
|
-
|
58
|
-
return next_url,body_status
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
"""
|
63
|
-
chat url get from htmljs
|
64
|
-
202077start
|
65
|
-
"""
|
66
|
-
def chat_url_get_js_extraction(url=@video_url)
|
31
|
+
def videoinfo_get(url=@video_url)
|
67
32
|
|
68
33
|
opt={}
|
69
34
|
next_url_polymer=""
|
70
35
|
next_url=""
|
71
36
|
|
72
|
-
|
73
|
-
|
37
|
+
videoinfo_respons,videoinfo_status=request_html_parse(url,opt)
|
38
|
+
videoinfo_respons.search('script').each do |script|
|
74
39
|
script=script.to_s
|
75
40
|
if script.include?("window[\"ytInitialData\"]") then
|
76
41
|
next_url_polymer=script.split("=",2)[1].split("\n",2)[0]
|
@@ -78,20 +43,35 @@ class Youtubelive_analyze |
|
78
43
|
next_url_polymer=JSON.parse(next_url_polymer)
|
79
44
|
end
|
80
45
|
end
|
81
|
-
|
82
|
-
|
83
|
-
next_url=@CHAT_REQUEST_URL+next_url
|
84
|
-
return next_url,chat_status
|
46
|
+
|
47
|
+
return next_url_polymer,videoinfo_status
|
85
48
|
end
|
86
49
|
|
87
50
|
|
51
|
+
|
52
|
+
def videoinfo_extraction()
|
53
|
+
videoinfo={}
|
54
|
+
common_hash=@videoinfo_polymer["contents"]["twoColumnWatchNextResults"]["results"]["results"]["contents"]
|
55
|
+
|
56
|
+
videoinfo["ch"]=common_hash[1]["videoSecondaryInfoRenderer"]["owner"]["videoOwnerRenderer"]["title"]["runs"][0]["text"]
|
57
|
+
videoinfo["title"]=common_hash[0]["videoPrimaryInfoRenderer"]["title"]["runs"][0]["text"]
|
58
|
+
videoinfo["starttime"]=common_hash[0]["videoPrimaryInfoRenderer"]["dateText"]["simpleText"]
|
59
|
+
videoinfo["videocount"]=common_hash[0]["videoPrimaryInfoRenderer"]["viewCount"]["videoViewCountRenderer"]["viewCount"]["simpleText"]
|
60
|
+
videoinfo["good"]=common_hash[0]["videoPrimaryInfoRenderer"]["videoActions"]["menuRenderer"]["topLevelButtons"][0]["toggleButtonRenderer"]["defaultText"]["simpleText"]
|
61
|
+
videoinfo["bad"]=common_hash[0]["videoPrimaryInfoRenderer"]["videoActions"]["menuRenderer"]["topLevelButtons"][1]["toggleButtonRenderer"]["defaultText"]["simpleText"]
|
62
|
+
|
63
|
+
return videoinfo
|
64
|
+
end
|
65
|
+
|
66
|
+
|
88
67
|
def chat_scrape(log_flag=true,log_path=@chatlog_filepath)
|
89
68
|
|
90
69
|
chat_body={}
|
91
70
|
chat_list=[]
|
92
71
|
chat_count=0
|
93
72
|
opt={'User-Agent' => @USER_AGENT}
|
94
|
-
next_url
|
73
|
+
next_url=@videoinfo_polymer["contents"]["twoColumnWatchNextResults"]["conversationBar"]["liveChatRenderer"]["continuations"][0]["reloadContinuationData"]["continuation"]
|
74
|
+
next_url=@CHAT_REQUEST_URL+next_url
|
95
75
|
|
96
76
|
while true do
|
97
77
|
|
@@ -123,7 +103,8 @@ class Youtubelive_analyze |
|
123
103
|
return chat_list
|
124
104
|
end
|
125
105
|
|
126
|
-
public :chat_scrape, :chat_url_get_iframe_extraction, :chat_url_get_js_extraction
|
127
|
-
private :videoid_get!, :videoinfo_get
|
128
106
|
|
129
|
-
|
107
|
+
public :chat_scrape
|
108
|
+
private :videoid_get!, :videoinfo_get, :videoinfo_extraction
|
109
|
+
|
110
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: video_chat_get
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tf0101
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|