Simulating views on Medium: How to use Selenium to boost your engagement (but also get banned)

How to Get Away with Dev
3 min readJan 13, 2023

Image by: Nejc Soklič

As a software developer, one of the most satisfying things is to see your work getting traction and engagement. As a Medium writer, one of the most important metrics is the number of views your articles receive. However, not all of us have the time or resources to promote our articles as much as we would like. In this article, I’ll show you how to use a Python script and the Selenium library to simulate views on your Medium articles, but also explain the dangers of getting banned.

How to simulate views using Selenium

The Selenium library is a popular tool for automating web browsers. It allows you to programmatically control a browser and interact with web pages as if you were a user. In this case, we can use Selenium to open a Medium article, scroll down the page, and simulate reading.

Here’s an example of a Python script that uses Selenium to open a Medium article in a private tab of Google Chrome, scroll down, and simulate reading for a specified number of views:

import random
import time
from selenium import webdriver

class MediumViewsSimulator:
"""
Class to simulate views on Medium articles using Selenium.
"""

def __init__(self, url: str, views: int):
"""
Initialize MediumViewsSimulator with url and views.

:param url: URL of the Medium article to simulate views on.
:param views: Number of views to simulate.
"""

self.url = url
self.views = views
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--incognito")
self.driver = webdriver.Chrome(chrome_options=chrome_options)

def _simulate_reading(self):
"""
Scroll down to a random point on the page and wait for a random amount of time.
"""

self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight*%f);" % random.random())
time.sleep(random.randint(5, 15))

def add_views(self):
"""
Open the Medium article, simulate reading for the specified number of views.
"""

self.driver.get(self.url)
for _ in range(self.views):
self._simulate_reading()
self.driver.quit()

medium_simulator = MediumViewsSimulator("https://medium.com/example-article", 10)
medium_simulator.add_views()

This script will open a Google Chrome browser in incognito mode, navigate to the specified URL, and then simulate reading by scrolling down to a random point on the page and waiting for a random amount of time, for the specified number of views.

As you can see, the script is using random.random() to generate a random floating point number between 0 and 1, this number will be used to multiply with the scrollHeight of the web page to scroll randomly in the page. Also, the script is using random.randint() to generate a random integer between 5 and 15 seconds to wait on each iteration.

You may also want to consider installing the chromedriver, Selenium and other necessary libraries to run the script in your local machine or in a cloud environment such as Google Collab.

The dangers of getting banned

Although simulating views on your Medium articles can boost your engagement, it also carries a significant risk of getting banned from the platform. Medium’s terms of service prohibit artificially inflating view counts and other metrics, and using a script like the one above would likely be considered a violation of these terms.

If you are caught artificially inflating your views, your account may be suspended or terminated, and you could lose access to your articles and the Medium community. Additionally, you may face legal or financial consequences if Medium decides to pursue action against you.

So, while the script above can be a fun way to experiment with Selenium and see how many views you can simulate, I highly recommend against using it to artificially inflate your views on Medium. Instead, focus on creating high-quality content and engaging with the Medium community.

It is important to note that this script is provided for educational and demonstration purposes only, using it to artificially inflate views on Medium.com is against Medium’s terms of service and could result in your account being suspended.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

How to Get Away with Dev
How to Get Away with Dev

Written by How to Get Away with Dev

Seasoned Data Scientist who still has a lot to learn sharing tips, tricks, and personal anecdotes to master the art of coding

No responses yet

Write a response