Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Spam
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @match https://tjournal.ru/*
- // @match https://dtf.ru/*
- // @grant GM_xmlhttpRequest
- // @connect api.tjournal.ru
- // @connect ws-sio.tjournal.ru
- // @connect api.dtf.ru
- // @connect ws-sio.dtf.ru
- // @require https://ws-sio.tjournal.ru/socket.io/socket.io.js
- // @run-at context-menu
- // ==/UserScript==
- /* global io */
- /* eslint-disable no-multi-spaces, curly */
- (function(){
- const userPathnamePattern = /\/\w+\/(\d+)/
- const regexRes = userPathnamePattern.exec(window.location.pathname)
- if (regexRes == null) {
- alert("Bad URL")
- return
- }
- const contentID = parseInt(regexRes[1])
- let wsUrl = null
- if (window.location.host === "tjournal.ru") {
- wsUrl = "wss://ws-sio.tjournal.ru"
- }
- if (window.location.host === "dtf.ru") {
- wsUrl = "wss://ws-sio.dtf.ru"
- }
- if (!wsUrl) {
- alert("Wrong host")
- return
- }
- console.log("Start spamming", contentID)
- const socket = io.connect(wsUrl, { transports: ["websocket"] })
- let count = prompt("How much views?")
- socket.on('connect', () => {
- console.log('Socket ID', socket.id)
- console.log('Connected', socket.connected)
- const channel = `content-hits-${contentID}`
- for (let i = 0; i < count; i++)
- {
- socket.emit("broadcast", { channel: channel, data: {content_id: contentID, type: "content viewed"}})
- }
- console.log("Spamming done")
- alert("Spamming done")
- socket.disconnect()
- })
- socket.on('error', e => console.warn('WebSocket server error',e))
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement