Sha256: cf3e77efe54ac34514acc7193b300f618f01ee7be640fa5c0c3a5b03fc088f91

Contents?: true

Size: 1.24 KB

Versions: 16

Compression:

Stored size: 1.24 KB

Contents

require 'site_list/video_analyze'
require 'requests/request'
require 'progressbars/progressbar'
require 'file_operats/file_operat_chatdata'



"""
"""

class Whowatch_analyze<Video_analyze

    attr_reader :video_id, :videoinfo, :chat_body, :videoandchat_info_request_status

    def initialize(url)
        @VIDEOINFO_REQEST_URL="https://api.whowatch.tv/lives/"
        
        @video_url=url
        @video_id=videoid_get()
        @videoinfo,@chat_body,@videoandchat_info_request_status=videoinfo_get(@VIDEOINFO_REQEST_URL+@video_id)
        @chatlog_filepath="./"+@video_id+".txt"

    end


    def videoid_get()
        return @video_url.split("/")[4]
    end


    def videoinfo_get(url)
        body,status=request_json_parse(url)
        chat_body=body.delete("comments")
        return body,chat_body,status
    end


    def chat_scrape(log_flag=true,log_path=@chatlog_filepath)

        chat_list=[]
        count=0
        
        @chat_body[0..-1].each do |chat|
            chat_list.push chat
            count+=1
            progressbar(count,@videoinfo["live"]["comment_count"])
        end
        
        file_write(chat_list,log_flag,log_path)
        return chat_list
     end

    public :chat_scrape
    private :videoid_get, :videoinfo_get

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
video_chat_get-0.3.6.10 lib/site_list/whowatch_analyze.rb
video_chat_get-0.3.6.9 lib/site_list/whowatch_analyze.rb
video_chat_get-0.3.6.8 lib/site_list/whowatch_analyze.rb
video_chat_get-0.3.6.5 lib/site_list/whowatch_analyze.rb
video_chat_get-0.3.6.4 lib/site_list/whowatch_analyze.rb
video_chat_get-0.3.6.3 lib/site_list/whowatch_analyze.rb
video_chat_get-0.3.6.2 lib/site_list/whowatch_analyze.rb
video_chat_get-0.3.6.1 lib/site_list/whowatch_analyze.rb
video_chat_get-0.2.6.1 lib/site_list/whowatch_analyze.rb
video_chat_get-0.2.6 lib/site_list/whowatch_analyze.rb
video_chat_get-0.2.3 lib/site_list/whowatch_analyze.rb
video_chat_get-0.2.2 lib/site_list/whowatch_analyze.rb
video_chat_get-0.2.1 lib/site_list/whowatch_analyze.rb
video_chat_get-0.2.0 lib/site_list/whowatch_analyze.rb
video_chat_get-0.1.9 lib/site_list/whowatch_analyze.rb
video_chat_get-0.1.6 lib/site_list/whowatch_analyze.rb