Skip to content

cocorum.static

This module provides static global data for use across the package, organized as class attributes. You may very well find a lot of these values useful directly as well.

Cocorum static variable definitions

Provides various data that, if changed, would need to change globally.

S.D.G.

Delays

Various times for delays and waits

Source code in cocorum/static.py
73
74
75
76
77
78
79
80
81
82
83
class Delays:
    """Various times for delays and waits"""

    #How long to wait before giving up on a network request, in seconds
    request_timeout = 20

    #How long to reuse old data from the main API, in seconds
    api_refresh_default = 10

    #Minimum refresh rate for the main API, as defined by Rumble
    api_refresh_minimum = 5

Message

For chat messages

Source code in cocorum/static.py
85
86
87
88
89
90
91
92
93
94
95
class Message:
    """For chat messages"""

    #Maximum chat message length
    max_len = 200

    #How long to wait between sending messages
    send_cooldown = 3

    #Prefix Rumble uses for native command
    command_prefix = "/"

Misc

No idea where else to put this data

Source code in cocorum/static.py
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
class Misc:
    """No idea where else to put this data"""
    #Numerical base that the stream ID is in
    base36 = "0123456789abcdefghijklmnopqrstuvwxyz"

    #Dictionary of badge slugs mapped to UTF-8 glyphs
    badges_as_glyphs = {
        "verified" : "✅",
        "admin" : "👑",
        "moderator" : "🛡",
        "premium" : "🗲",
        "locals" : "♖",
        "recurring_subscription" : "♖",
        "locals_supporter" : "⛋",
        "whale-grey" : "🐳",
        "whale-yellow" : "🐳",
        "whale-blue" : "🐳",
        }

    #Encoding for all text-bytes conversions
    text_encoding = "utf-8"

    #Size of chat badge icons to retrieve, only valid one has long been the string 48
    badge_icon_size = "48"

    #Rumble timestamp format, not including the 6 TODO characters at the end
    timestamp_format = "%Y-%m-%dT%H:%M:%S"

    #Key of the session token within the session cookie dict
    session_token_key = "u_s"

    class ContentTypes:
        """Types of content that can be rumbled on"""

        #A video or livestream
        video = 1

        #A comment
        comment = 2

ContentTypes

Types of content that can be rumbled on

Source code in cocorum/static.py
139
140
141
142
143
144
145
146
class ContentTypes:
    """Types of content that can be rumbled on"""

    #A video or livestream
    video = 1

    #A comment
    comment = 2

RequestHeaders

Headers for various HTTPrequests

Source code in cocorum/static.py
 8
 9
10
11
12
13
14
15
class RequestHeaders:
    """Headers for various HTTPrequests"""

    #Header with a fake user-agent string
    user_agent = {"User-Agent" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"}

    #Headers for the SSE chat API
    sse_api = {'Accept': 'text/event-stream'}

StaticAPIEndpoints

API endpoints that don't change and shouldn't trigger a refresh

Source code in cocorum/static.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class StaticAPIEndpoints:
    """API endpoints that don't change and shouldn't trigger a refresh"""
    #Endpoints of the main API
    main = [
        "user_id",
        "username",
        "channel_id",
        "channel_name",
        ]

    #Endpoints of the stream subobject
    stream = [
        "id",
        "created_on"
        ]

URI

URIs to various Rumble services

Source code in cocorum/static.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class URI:
    """URIs to various Rumble services"""

    #Base URL to Rumble's website, for URLs that are relative to it
    rumble_base = "https://rumble.com"

    #Test the session token by sending it here and checking the title
    login_test = rumble_base + "/login.php"

    #Webpage with all the mutes on it, format with page number
    mutes_page = rumble_base + "/account/moderation/muting?pg={page}"

    #Channels under a user, format with username
    channels_page = rumble_base + "/user/{username}/channels"

    #The logged-in user's playlist page
    playlists_page = rumble_base + "/my-library/playlists"

    #The Service.PHP API
    servicephp = "https://rumble.com/service.php"

    #The video upload PHP
    uploadphp = "https://web18.rumble.com/upload.php"

    class ChatAPI:
        """URIs of the chat API"""

        #Rumble's internal chat URL for a stream, format this string with a stream_id_b10
        base = "https://web7.rumble.com/chat/api/chat/{stream_id_b10}"

        #SSE stream of chat events
        sse_stream = base + "/stream"

        #Message actions
        message = base + "/message"

        #Chat commands (does not use the base)
        command = "https://rumble.com/chat/command"

ChatAPI

URIs of the chat API

Source code in cocorum/static.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class ChatAPI:
    """URIs of the chat API"""

    #Rumble's internal chat URL for a stream, format this string with a stream_id_b10
    base = "https://web7.rumble.com/chat/api/chat/{stream_id_b10}"

    #SSE stream of chat events
    sse_stream = base + "/stream"

    #Message actions
    message = base + "/message"

    #Chat commands (does not use the base)
    command = "https://rumble.com/chat/command"

Upload

Data relating to uploading videos

Source code in cocorum/static.py
 97
 98
 99
100
101
102
103
104
105
106
class Upload:
    """Data relating to uploading videos"""
    #Size of upload chunks, not sure if this can be changed
    chunksz = 10000000

    #Upload API version to use
    api_ver = "1.3"

    #Maximum upload size is 15GB as stated by Rumble
    max_filesize = 15 * (1000 ** 3)

S.D.G.