video_chat_get 0.1.6 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4c548904d898fbcd56d725e6b7a7dd45df9f8d1a6133f279e0e7edb8a679bac
4
- data.tar.gz: 29a668bf9086627306e46d436e93a4d1391cea3467e34791092f6f2332802c03
3
+ metadata.gz: 72c2d47a8f701af1d42780d9261be02ca29d743800971982bf42b9438ee4bdba
4
+ data.tar.gz: 90d62278f6cfee916570aad6ebe63acfb4122d9d19eb2f7dba4ef4b153561090
5
5
  SHA512:
6
- metadata.gz: 2a0123fff8d7773855e61ce3a7ff5aaf4dc94a0b361902ee7c3133ddc5f32897ea2a6092d920f85fffdd67ca129a77860b1a8e07f4232751ab447a4bd53fe6d4
7
- data.tar.gz: 9b9e4a2071cd9f3674c66982f378d205d38f6dd814280455444cf521f48dd9fa3a401b5c4269ef2883fa617344bd5214404d8f1ef7e629d2e4dc1507c4fff8d3
6
+ metadata.gz: 45ed4d022d5b3b40da4ee41103fa589ad4eed996c1ece2afffbfcedfaed0621acac7ffe1555d9b6237d048fe2e5bd5fea06ed128913acedbe665cc1025d6a472
7
+ data.tar.gz: bafe20e7dbc9b3e67ac1f7d41aebebbde6bb43930e5cd5a300ce8b3babbfc79b408db9428834e0d5de9eaa2e62420f10440d83d518fe662d3e3f4a514957ffe9
data/.circleci/config.yml CHANGED
@@ -1,4 +1,8 @@
1
1
  version: 2.1
2
+
3
+ orbs:
4
+ slack: circleci/slack@3.3.0
5
+
2
6
  executors:
3
7
  my-executor:
4
8
  docker:
@@ -27,13 +31,25 @@ jobs:
27
31
  - run:
28
32
  name: bundle exec rake spec
29
33
  command: bundle exec rake spec
34
+
35
+ - slack/status:
36
+ success_message: ':circleci-pass: $CIRCLE_BRANCH のテストが完了しました\n:github_octocat: User:$CIRCLE_USERNAME'
37
+ failure_message: ':circleci-fail: $CIRCLE_BRANCH のテストが失敗しました\n:github_octocat: User:$CIRCLE_USERNAME'
38
+ webhook: '${SLACK_WEBHOOK}'
30
39
 
31
40
  workflows:
32
41
  version: 2
33
- test-:
42
+ test:
34
43
  jobs:
35
- - test:
36
- filters:
44
+ - test
45
+
46
+ test_cron:
47
+ triggers:
48
+ - schedule:
49
+ cron: "0 21 * * 0"
50
+ filters:
37
51
  branches:
38
52
  only:
39
- - master
53
+ - master
54
+ jobs:
55
+ - test
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- video_chat_get (0.1.6)
4
+ video_chat_get (0.1.9)
5
5
  httpclient (~> 2.8.3)
6
6
  json (~> 2.3.0)
7
7
  nokogiri (~> 1.10.9)
@@ -56,8 +56,8 @@ class Twitcasting_analyze<Video_analyze
56
56
 
57
57
 
58
58
  def chat_page_range()
59
- size=@chat_request_body.css(".paging").css("a").size()
60
- range=@chat_request_body.css(".paging").css("a")[size-1].text
59
+ size=@chat_request_body.css(".tw-pager").css("a").size()
60
+ range=@chat_request_body.css(".tw-pager").css("a")[size-1].text
61
61
  return range.to_i
62
62
  end
63
63
 
@@ -28,10 +28,24 @@ class Youtubelive_analyze<Video_analyze
28
28
 
29
29
 
30
30
  def videoinfo_get()
31
+
31
32
  videoinfo_respons,videoinfo_status=request_html_parse(@video_url,{})
32
- return htmlpage_script_parse(videoinfo_respons,method(:videoinfo_script_cleanup)),videoinfo_status
33
+
34
+ videoinfo_respons.search('script').each do |script|
35
+
36
+ if script.to_s.include?("window[\"ytInitialData\"]") then
37
+ return htmlpage_script_parse(script,method(:videoinfo_script_cleanup)),videoinfo_status
38
+ end
39
+
40
+ if script.to_s.include?("var ytInitialData =") then
41
+ return htmlpage_script_parse(script,method(:videoinfo_script_cleanup_p2)),videoinfo_status
42
+ end
43
+
44
+ end
45
+
46
+ return ""
33
47
  end
34
-
48
+
35
49
 
36
50
  def videoinfo_extraction()
37
51
 
@@ -53,27 +67,35 @@ class Youtubelive_analyze<Video_analyze
53
67
  end
54
68
 
55
69
 
70
+ def videoinfo_script_cleanup_p2(script_date)
71
+ return script_date.split("var ytInitialData =",2)[1].split(";if (window.ytcsi)",2)[0].strip.chomp(";</script>").strip
72
+ end
73
+
74
+
56
75
  def chatinfo_script_cleanup(script_date)
57
- return script_date.split("=",2)[1].chomp("</script>").strip.chomp(";")
76
+ return script_date.split('window["ytInitialData"] = ',2)[1].strip.chomp("</script>").strip.chomp(";")
58
77
  end
59
78
 
60
79
 
61
80
  def htmlpage_script_parse(respons,callback)
62
-
63
- respons.search('script').each do |script|
64
- if script.to_s.include?("window[\"ytInitialData\"]") then
65
- script_body=callback.call(script.to_s)
66
- script_body=JSON.parse(script_body)
67
- return script_body
68
- end
69
- end
70
- return ""
81
+ script_body=callback.call(respons.to_s)
82
+ return JSON.parse(script_body)
71
83
  end
72
84
 
73
85
 
74
86
  def chat_body_get(next_url, opt={'User-Agent' => @USER_AGENT})
87
+
75
88
  chat_respons,chat_status=request_html_parse(next_url,opt)
76
- return htmlpage_script_parse(chat_respons,method(:chatinfo_script_cleanup))
89
+
90
+ chat_respons.search('script').each do |script|
91
+
92
+ if script.to_s.include?("window[\"ytInitialData\"]") then
93
+ return htmlpage_script_parse(script,method(:chatinfo_script_cleanup))
94
+ end
95
+
96
+ end
97
+
98
+ return ""
77
99
  end
78
100
 
79
101
 
@@ -108,6 +130,6 @@ class Youtubelive_analyze<Video_analyze
108
130
 
109
131
 
110
132
  public :chat_scrape
111
- private :videoid_get, :videoinfo_get, :videoinfo_extraction, :htmlpage_script_parse, :videoinfo_script_cleanup, :chatinfo_script_cleanup, :chat_body_get
133
+ private :videoid_get, :videoinfo_get, :videoinfo_extraction, :htmlpage_script_parse, :videoinfo_script_cleanup, :chatinfo_script_cleanup, :chat_body_get, :videoinfo_script_cleanup_p2
112
134
 
113
135
  end
@@ -1,3 +1,3 @@
1
1
  module VideoChatGet
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.9"
3
3
  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.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - tf0101
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-24 00:00:00.000000000 Z
11
+ date: 2021-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler