Skip to content

Instantly share code, notes, and snippets.

@zeuxisoo
Last active November 2, 2017 22:43
Show Gist options
  • Save zeuxisoo/5689541 to your computer and use it in GitHub Desktop.
Save zeuxisoo/5689541 to your computer and use it in GitHub Desktop.
Remove all my plurk posts
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import mechanize
from colorama import init
from colorama import Fore, Back, Style
init()
def main():
# Login
print(Fore.CYAN + "Try to login plurk account")
browser = mechanize.Browser()
browser.open("http://www.plurk.com/m/login")
browser.select_form(nr=0)
browser['username'] = "======================"
browser['password'] = "======================"
response = browser.submit()
print("")
while(1):
# Go to my plurks tab
browser.open("http://www.plurk.com/m/?mode=my")
print(Fore.MAGENTA + "Try to enter your pluk list")
# Get plurks count
remain = sum(1 for _ in browser.links(url_regex=r"^/m/p/[0-9A-Za-z]+$"))
print(Fore.YELLOW + "In your remain plurk: {0}".format(remain))
if remain <= 0:
break
# Goto post detail page
browser.follow_link(url_regex=r"^/m/p/[0-9A-Za-z]+$", nr=0)
print(Fore.GREEN + "In post detail page : {0}".format(browser.geturl()))
# Goto delete page
browser.follow_link(url_regex=r'^/m/p/[0-9A-Za-z]+/d$')
print(Fore.GREEN + "In post delete page : {0}".format(browser.geturl()))
# Remove the plurk
browser.select_form(nr=0)
browser.submit()
print(Fore.GREEN + "In post removed page: {0}".format(browser.geturl()))
print("")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment