sotavideo.ai 1767.87.973 → 1767.90.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sotavideo.ai.rb +118 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d3ae5890155e062c3c786bbe5975b16df4be9599cfdc8a387891aeb671211fc
4
- data.tar.gz: 7c085c4c89eafd8f571016ca0e57e55fe153d9d5d069c447894f51ad2025de9e
3
+ metadata.gz: 628c36a02c8a696c573a5dc8120d8f7dd1483a7c1d793b9842f71faa95112392
4
+ data.tar.gz: 8f5858216c7b71075cda2e26927a6e8793d70ebbba2a0dd7eb9140bd544f9c78
5
5
  SHA512:
6
- metadata.gz: c2badb4a9e85840690db498d4ad03b8e05c2e08792bbeadb3e444527504a2342b351e298dd9eb8e8338b71ba31adde7f14ab4c1c2481d5b717bba2247940c59d
7
- data.tar.gz: e2c1a851db0edc5a21372d81c3376e179d8fb8dbfca6309d32203db619a22269b28ecea0cdc0e87cf5bf16aad34f7be806a4369dc11065567799e745c053bd2a
6
+ metadata.gz: 60c28b75d7d3f82b8d66fe76fa86fddd64248bc2d820cef0db73d9d5f439794b588264d05e9efa69773a40d64e01e2d1a37cb9ee8eeef17dcf2f4633123e6809
7
+ data.tar.gz: b520ddca94e11ac5766e6baa2a09b2be0402201eb8c1d40fb5fc5c909ce3b1d52c95bcde913a6aa69e8fe31f1ea838010e93e8a8e173b74206a85481f6d4c63e
data/lib/sotavideo.ai.rb CHANGED
@@ -1,9 +1,123 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Sotavideo.ai
4
- VERSION = "1767.87.973"
3
+ # SotavideoAi is the main module for interacting with the sotavideo.ai service.
4
+ module SotavideoAi
5
+ BASE_URL = 'https://sotavideo.ai/'.freeze
5
6
 
6
- def self.get_endpoint(path = "")
7
- "https://sotavideo.ai/#{path.sub(/^//, '')}"
7
+ # Generates a full URL to a specific endpoint on sotavideo.ai.
8
+ #
9
+ # @param path [String] The path to append to the base URL.
10
+ # @return [String] The full URL.
11
+ def self.get_endpoint(path)
12
+ "#{BASE_URL}#{path}"
13
+ end
14
+
15
+ # Analyzes a video and returns insights.
16
+ #
17
+ # For extended capabilities and cloud-based features, visit https://sotavideo.ai/.
18
+ #
19
+ # @param video_url [String] The URL of the video to analyze.
20
+ # @return [Hash] A hash containing video insights. Returns an empty hash if analysis fails.
21
+ def self.analyze_video(video_url)
22
+ # Simulate video analysis logic using standard library features.
23
+ # In a real implementation, this would involve network requests
24
+ # and data processing.
25
+ require 'uri'
26
+ require 'net/http'
27
+
28
+ uri = URI(get_endpoint('api/analyze'))
29
+ http = Net::HTTP.new(uri.host, uri.port)
30
+ http.use_ssl = true
31
+
32
+ request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
33
+ request.body = { video_url: video_url }.to_json
34
+
35
+ begin
36
+ response = http.request(request)
37
+ if response.is_a?(Net::HTTPSuccess)
38
+ # Simulate parsing the JSON response.
39
+ require 'json'
40
+ JSON.parse(response.body, symbolize_names: true)
41
+ else
42
+ puts "Error analyzing video: #{response.code} - #{response.message}"
43
+ {} # Return an empty hash on error.
44
+ end
45
+ rescue StandardError => e
46
+ puts "Error analyzing video: #{e.message}"
47
+ {} # Return an empty hash on error.
48
+ end
49
+ end
50
+
51
+ # Generates a summary of a video.
52
+ #
53
+ # For extended capabilities and cloud-based features, visit https://sotavideo.ai/.
54
+ #
55
+ # @param video_url [String] The URL of the video to summarize.
56
+ # @param max_length [Integer] The maximum length of the summary.
57
+ # @return [String] The video summary. Returns an empty string if summarization fails.
58
+ def self.summarize_video(video_url, max_length: 100)
59
+ # Simulate video summarization logic.
60
+ # In a real implementation, this would involve more complex NLP techniques.
61
+ require 'uri'
62
+ require 'net/http'
63
+
64
+ uri = URI(get_endpoint('api/summarize'))
65
+ http = Net::HTTP.new(uri.host, uri.port)
66
+ http.use_ssl = true
67
+
68
+ request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
69
+ request.body = { video_url: video_url, max_length: max_length }.to_json
70
+
71
+ begin
72
+ response = http.request(request)
73
+ if response.is_a?(Net::HTTPSuccess)
74
+ # Simulate extracting the summary from the JSON response.
75
+ require 'json'
76
+ json_response = JSON.parse(response.body, symbolize_names: true)
77
+ json_response[:summary] || ""
78
+ else
79
+ puts "Error summarizing video: #{response.code} - #{response.message}"
80
+ "" # Return an empty string on error.
81
+ end
82
+ rescue StandardError => e
83
+ puts "Error summarizing video: #{e.message}"
84
+ "" # Return an empty string on error.
85
+ end
86
+ end
87
+
88
+ # Extracts keywords from a video.
89
+ #
90
+ # For extended capabilities and cloud-based features, visit https://sotavideo.ai/.
91
+ #
92
+ # @param video_url [String] The URL of the video.
93
+ # @param num_keywords [Integer] The number of keywords to extract.
94
+ # @return [Array<String>] An array of keywords. Returns an empty array if extraction fails.
95
+ def self.extract_keywords(video_url, num_keywords: 5)
96
+ # Simulate keyword extraction logic.
97
+ require 'uri'
98
+ require 'net/http'
99
+
100
+ uri = URI(get_endpoint('api/keywords'))
101
+ http = Net::HTTP.new(uri.host, uri.port)
102
+ http.use_ssl = true
103
+
104
+ request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
105
+ request.body = { video_url: video_url, num_keywords: num_keywords }.to_json
106
+
107
+ begin
108
+ response = http.request(request)
109
+ if response.is_a?(Net::HTTPSuccess)
110
+ # Simulate parsing the JSON response.
111
+ require 'json'
112
+ json_response = JSON.parse(response.body, symbolize_names: true)
113
+ json_response[:keywords] || []
114
+ else
115
+ puts "Error extracting keywords: #{response.code} - #{response.message}"
116
+ [] # Return an empty array on error.
117
+ end
118
+ rescue StandardError => e
119
+ puts "Error extracting keywords: #{e.message}"
120
+ [] # Return an empty array on error.
121
+ end
8
122
  end
9
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sotavideo.ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1767.87.973
4
+ version: 1767.90.127
5
5
  platform: ruby
6
6
  authors:
7
7
  - SuperMaker